-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Compiler version
3.6.4
Minimized code
class Foo { type T }
// `def` works fine
def foo[A]: Foo { type T = A } =
new Foo { type T = A }
// `given` does not: Syntax error: 'with' expected, but '{' found
given bar[A]: Foo { type T = A } =
new Foo { type T = A }
// workaround: add parentheses
given baz[A]: (Foo { type T = A }) =
new Foo { type T = A }
Output
-- [E040] Syntax Error: Test.scala:8:18 ----------------------------------------
8 |given bar[A]: Foo { type T = A } =
| ^
| 'with' expected, but '{' found
-- [E040] Syntax Error: Test.scala:14:0 ----------------------------------------
14 |
|^
|'}' expected, but eof found
2 errors found
Expectation
I would expect def
and given
syntax to be consistent as much as possible.