diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 2 | ||||
-rw-r--r-- | test/files/run/t9223.scala | 8 | ||||
-rw-r--r-- | test/files/run/t9223b.scala | 8 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 3a85d16f55..758425aad5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2053,7 +2053,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper case acc => acc } ownAcc match { - case acc: TermSymbol if !acc.isVariable => + case acc: TermSymbol if !acc.isVariable && !isByNameParamType(acc.info) => debuglog(s"$acc has alias ${alias.fullLocationString}") acc setAlias alias case _ => diff --git a/test/files/run/t9223.scala b/test/files/run/t9223.scala new file mode 100644 index 0000000000..78767b158d --- /dev/null +++ b/test/files/run/t9223.scala @@ -0,0 +1,8 @@ +class X(val x: String) +class Y(y: => String) extends X(y) { def f = y } + +object Test { + def main(args: Array[String]): Unit = { + assert(new Y("hi").f == "hi") + } +} diff --git a/test/files/run/t9223b.scala b/test/files/run/t9223b.scala new file mode 100644 index 0000000000..2afc7ddfe0 --- /dev/null +++ b/test/files/run/t9223b.scala @@ -0,0 +1,8 @@ +class X(x: => String) { def xx = x } +class Y(y: String) extends X(y) { def f = y } + +object Test { + def main(args: Array[String]): Unit = { + assert(new Y("hi").f == "hi") + } +} |