Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object Test { trait A { a => type X val x: a.X } val a = new A { type X = Int val x = 1 } def f(arg: A): arg.X = arg.x val x = f(a: A) }
snippet from -Xprint:typer:
... private[this] val x: arg.X = Test.this.f((Test.this.a: Test.A)); <stable> <accessor> def x: arg.X = Test.this.x ...
arg is not in scope...
I don't know yet how to turn this into a true soundness issue, but it's weird.
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-7084?orig=1 Reporter: @namin See #3873
Sorry, something went wrong.
@retronym said: Reflecting my way to the same conclusions as you reached:
scala> :power Already in power mode. scala> val u = rootMirror.universe; import u._, language._, intp.deconstruct.showu: u.type = scala.tools.nsc.interpreter.IMain$$anon$1@4a2e2b5c import u._ import language._ import intp.deconstruct.show scala> object Foo { trait A { type X }; def id(a: A): a.X = ???; def foo = id(??? : A) } defined module Foo scala> val fooTpe = typeOf[Foo.type].decl(newTermName("foo")).tpe.resultType fooTpe: u.Type = a.X scala> val aSym = fooTpe.prefix.asInstanceOf[SingleType].sym aSym: u.Symbol = value a scala> aSym.isValueParameter res62: Boolean = true scala> aSym.owner res63: u.Symbol = method id
I was also unable to poke a soundness hole:
object Foo { trait A { trait X { type A; def f(a: A); val a: A }; def X: X }; object i extends A { object X extends super.X { type A = Int; def f(a: Int) = (); val a = 0 } }; object s extends A { object X extends super.X { type A = String; def f(a: String) = (); val a = "" } }; def id(a: A): a.X = a.X val x = id(i : A) // x: a.X id(i : A).f(id(s : A).a) // <console>:47: error: type mismatch; // found : a.X#A // required: _31.A where val _31: a.X // id(i : A).f(id(s : A).a) }
This commit to InstantiateDependentMap is work a look:
InstantiateDependentMap
scala/scala@b40f4ba322
No branches or pull requests
snippet from -Xprint:typer:
... private[this] val x: arg.X = Test.this.f((Test.this.a: Test.A)); <stable> <accessor> def x: arg.X = Test.this.x ...arg is not in scope...
I don't know yet how to turn this into a true soundness issue, but it's weird.
The text was updated successfully, but these errors were encountered: