From d7fba01deac642061c748427df89e3a41aa477a3 Mon Sep 17 00:00:00 2001 From: Jaemin Hong Date: Wed, 25 Jul 2018 16:52:16 +0200 Subject: [PATCH] Fix #4653: check method return type is value type --- compiler/src/dotty/tools/dotc/typer/Namer.scala | 2 +- tests/neg/i4653.scala | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i4653.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala index bca80fad2687..2933c3dc92a5 100644 --- a/compiler/src/dotty/tools/dotc/typer/Namer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala @@ -1153,7 +1153,7 @@ class Namer { typer: Typer => case _ => WildcardType } - paramFn(typedAheadType(mdef.tpt, tptProto).tpe) + paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe) } /** The type signature of a DefDef with given symbol */ diff --git a/tests/neg/i4653.scala b/tests/neg/i4653.scala new file mode 100644 index 000000000000..b4a3411da10b --- /dev/null +++ b/tests/neg/i4653.scala @@ -0,0 +1,14 @@ +trait T { + type S +} + +class C { + class D[X](val t: T) { + def bar: t.S = ??? + } + + def fooD: D = ??? // error + fooD.bar + + def f(fooV: => D): Any = fooV.bar // error +}