Skip to content

Commit 3522036

Browse files
Funny Fix
1 parent c3c5e8f commit 3522036

File tree

2 files changed

+40
-37
lines changed

2 files changed

+40
-37
lines changed

hkmc2/shared/src/main/scala/hkmc2/semantics/Term.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ sealed trait Statement extends AutoLocated with ProductWithExtraInfo:
176176

177177
def extraInfo: Str = this match
178178
case ref: Ref if ref.resSym.isEmpty => ""
179-
case r: (Resolvable & Term) => r.symbol.mkString
179+
case r: (Resolvable & Term | SelProj) => r.symbol.mkString
180180
case _ => ""
181181

182182
def subStatements: Ls[Statement] = this match

hkmc2/shared/src/test/mlscript/ctx/CascadingTypeClasses.mls

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,130 +6,133 @@ class Bar[B]
66
class Baz
77

88

9-
fun foo[A](using Foo[A], A)
9+
fun foo[A](using Foo[A], A) = 42
1010

1111
use Foo[Baz] = new Foo
1212

1313

1414
// FIXME: error message refers to `A`
15+
1516
:e
16-
:fixme // Internal Error should never reach users
17+
:re
1718
foo[Baz]
1819
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
19-
//│ ║ l.17: foo[Baz]
20+
//│ ║ l.18: foo[Baz]
2021
//│ ║ ^^^^^^^
2122
//│ ╟── Required by contextual parameter declaration:
22-
//│ ║ l.9: fun foo[A](using Foo[A], A)
23+
//│ ║ l.9: fun foo[A](using Foo[A], A) = 42
2324
//│ ║ ^
2425
//│ ╙── Expected: A; Available: (Foo[Baz])
25-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
26+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 2 arguments but got 1
2627

2728
:e
28-
:fixme // Internal Error should never reach users
29+
:re
2930
foo
3031
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
31-
//│ ║ l.29: foo
32+
//│ ║ l.30: foo
3233
//│ ║ ^^^
3334
//│ ╟── Required by contextual parameter declaration:
34-
//│ ║ l.9: fun foo[A](using Foo[A], A)
35+
//│ ║ l.9: fun foo[A](using Foo[A], A) = 42
3536
//│ ║ ^
3637
//│ ╙── Expected: A; Available: (Foo[Baz])
37-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
38+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 2 arguments but got 1
3839

3940

4041
use Baz = new Baz
4142

4243
:todo
4344
foo
4445
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
45-
//│ ║ l.43: foo
46+
//│ ║ l.44: foo
4647
//│ ║ ^^^
4748
//│ ╟── Required by contextual parameter declaration:
48-
//│ ║ l.9: fun foo[A](using Foo[A], A)
49+
//│ ║ l.9: fun foo[A](using Foo[A], A) = 42
4950
//│ ║ ^
5051
//│ ╙── Expected: A; Available: (Foo[Baz], Baz)
51-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
52+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 2 arguments but got 1
5253

5354

54-
fun foo[A](using Foo[A])(using A)
55+
fun foo[A](using Foo[A])(using A) = 42
5556

5657
:todo
5758
foo
5859
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
59-
//│ ║ l.57: foo
60+
//│ ║ l.58: foo
6061
//│ ║ ^^^
6162
//│ ╟── Required by contextual parameter declaration:
62-
//│ ║ l.54: fun foo[A](using Foo[A])(using A)
63+
//│ ║ l.55: fun foo[A](using Foo[A])(using A) = 42
6364
//│ ║ ^
6465
//│ ╙── Expected: A; Available: (Foo[Baz], Baz)
65-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
66+
//│ ═══[RUNTIME ERROR] Error: Function expected 1 argument but got 0
6667

6768

68-
fun foo[A](using A)(using Foo[A])
69+
fun foo[A](using A)(using Foo[A]) = 42
6970

7071
:todo
7172
foo
7273
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
73-
//│ ║ l.71: foo
74+
//│ ║ l.72: foo
7475
//│ ║ ^^^
7576
//│ ╟── Required by contextual parameter declaration:
76-
//│ ║ l.68: fun foo[A](using A)(using Foo[A])
77+
//│ ║ l.69: fun foo[A](using A)(using Foo[A]) = 42
7778
//│ ║ ^
7879
//│ ╙── Expected: A; Available: (Foo[Baz], Baz)
79-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
80+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 1 argument but got 0
8081

8182

8283
use Foo[Bar[Baz]] = new Foo
8384

84-
:fixme // Internal Error should never reach users
8585
:e
86+
:re
8687
foo
8788
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
88-
//│ ║ l.86: foo
89+
//│ ║ l.87: foo
8990
//│ ║ ^^^
9091
//│ ╟── Required by contextual parameter declaration:
91-
//│ ║ l.68: fun foo[A](using A)(using Foo[A])
92+
//│ ║ l.69: fun foo[A](using A)(using Foo[A]) = 42
9293
//│ ║ ^
9394
//│ ╙── Expected: A; Available: (Foo[Bar[Baz]], Foo[Baz], Baz)
94-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
95+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 1 argument but got 0
9596

9697
use Bar[Baz] = new Bar
9798

98-
:fixme
99+
:e
100+
:re
99101
foo
100102
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
101-
//│ ║ l.99: foo
102-
//│ ║ ^^^
103+
//│ ║ l.101: foo
104+
//│ ║ ^^^
103105
//│ ╟── Required by contextual parameter declaration:
104-
//│ ║ l.68: fun foo[A](using A)(using Foo[A])
106+
//│ ║ l.69: fun foo[A](using A)(using Foo[A]) = 42
105107
//│ ║ ^
106108
//│ ╙── Expected: A; Available: (Foo[Bar[Baz]], Foo[Baz], Baz, Bar[Baz])
107-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
109+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 1 argument but got 0
108110

109111
use Bar[Int] = new Bar
110112

111-
:fixme
113+
:e
114+
:re
112115
foo
113116
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
114-
//│ ║ l.112: foo
117+
//│ ║ l.115: foo
115118
//│ ║ ^^^
116119
//│ ╟── Required by contextual parameter declaration:
117-
//│ ║ l.68: fun foo[A](using A)(using Foo[A])
120+
//│ ║ l.69: fun foo[A](using A)(using Foo[A]) = 42
118121
//│ ║ ^
119122
//│ ╙── Expected: A; Available: (Foo[Bar[Baz]], Foo[Baz], Baz, Bar[Int], Bar[Baz])
120-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
123+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 1 argument but got 0
121124

122125
use Bar[Baz] = new Bar
123126

124127
:todo
125128
foo
126129
//│ ╔══[ERROR] Missing instance for contextual parameter of type `A` in this call
127-
//│ ║ l.125: foo
130+
//│ ║ l.128: foo
128131
//│ ║ ^^^
129132
//│ ╟── Required by contextual parameter declaration:
130-
//│ ║ l.68: fun foo[A](using A)(using Foo[A])
133+
//│ ║ l.69: fun foo[A](using A)(using Foo[A]) = 42
131134
//│ ║ ^
132135
//│ ╙── Expected: A; Available: (Foo[Bar[Baz]], Foo[Baz], Baz, Bar[Baz], Bar[Int], Bar[Baz])
133-
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)
136+
//│ ═══[RUNTIME ERROR] Error: Function 'foo' expected 1 argument but got 0
134137

135138

0 commit comments

Comments
 (0)