Skip to content

Cannot write refined given aliases #8284

Closed
@nicolasstucki

Description

@nicolasstucki

minimized code

type Foo
given myFoo1 as Foo { type X = Int } = ??? // error

type Bar = Foo { type X = Int }
given myFoo2 as Bar = ???

Compilation output

2 |given myFoo1 as Foo { type X = Int } = ???
  |                                     ^
  |                                   end of statement expected but '=' found
-- [E040] Syntax Error: Foo.scala:2:39 -----------------------------------------
2 |given myFoo1 as Foo { type X = Int } = ???
  |                                       ^^^
  |                                       ';' expected, but identifier found
-- Error: Foo.scala:2:16 -------------------------------------------------------
2 |given myFoo1 as Foo { type X = Int } = ???
  |                ^^^
  |                Foo is not a class type

expectation

given myFoo1 as Foo { type X = Int } = ??? 

myFoo1 should be handled as a given alias and should compile the same way myFoo2 does.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions