We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 89dbf92 + 3aba884 commit f08cd3cCopy full SHA for f08cd3c
compiler/src/dotty/tools/dotc/core/TypeErasure.scala
@@ -239,8 +239,7 @@ object TypeErasure {
239
* TermRefs are kept instead of being widened away.
240
*/
241
def erasedRef(tp: Type)(using Context): Type = tp match {
242
- case tp: TermRef =>
243
- assert(tp.symbol.exists, tp)
+ case tp: TermRef if tp.symbol.exists =>
244
val tp1 = makePackageObjPrefixExplicit(tp)
245
if (tp1 ne tp) erasedRef(tp1)
246
else TermRef(erasedRef(tp.prefix), tp.symbol.asTerm)
tests/pos/i18721.min/core.scala
@@ -0,0 +1,5 @@
1
+class Foo
2
+class Bar extends Selectable:
3
+ def selectDynamic(name: String): Foo = null
4
+
5
+inline def meth(inline foo: Foo): Foo = foo
tests/pos/i18721.min/main.scala
@@ -0,0 +1,3 @@
+class Test:
+ def t1(bar: Bar { val foo: Foo }): Any =
+ meth(bar.foo)
0 commit comments