Skip to content

Commit e85a91e

Browse files
authored
Merge pull request #4844 from Medowhill/issue4653
Fix #4653: check method return type is value type
2 parents 896598a + d7fba01 commit e85a91e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ class Namer { typer: Typer =>
11531153
case _ =>
11541154
WildcardType
11551155
}
1156-
paramFn(typedAheadType(mdef.tpt, tptProto).tpe)
1156+
paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe)
11571157
}
11581158

11591159
/** The type signature of a DefDef with given symbol */

tests/neg/i4653.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
trait T {
2+
type S
3+
}
4+
5+
class C {
6+
class D[X](val t: T) {
7+
def bar: t.S = ???
8+
}
9+
10+
def fooD: D = ??? // error
11+
fooD.bar
12+
13+
def f(fooV: => D): Any = fooV.bar // error
14+
}

0 commit comments

Comments
 (0)