scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.72k stars 1.04k forks source link

CC can't track parameters to superclasses #15114

Open anatoliykmetyuk opened 2 years ago

anatoliykmetyuk commented 2 years ago

Compiler version

cc-experiment head, 08597054504d8deeee543301b771c509074b8993 commit.

Minimized code

trait Foo(val m: {*} String):
  val x: {m} Int = 10

@main def Test =
  val y = new Foo("Mutation") {
    override val x: {m} Int = 20
  }

Output

-- Error: /Users/kmetiuk/Projects/scala3/playground/cc-demo/Test.scala:45:21 ---                                                                                                                                                                                                                            
45 |    override val x: {m} Int = 20
   |                     ^
   |     m cannot be tracked since it is not a parameter or a local variable

Expectation

Should compile.

odersky commented 2 years ago

Yes, that's a know implementation restriction, for now.