diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index db2ce56496f9..fc96735b0cb0 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -306,8 +306,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { case _ => false } - typeIsElidable || - tp.symbol.is(JavaStatic) || + typeIsElidable || + tp.symbol.is(JavaStatic) || tp.symbol.hasAnnotation(defn.ScalaStaticAnnot) } @@ -343,6 +343,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def singleton(tp: Type)(implicit ctx: Context): Tree = tp match { case tp: TermRef => ref(tp) case tp: ThisType => This(tp.cls) + case tp: SkolemType => singleton(tp.narrow) case SuperType(qual, _) => singleton(qual) case ConstantType(value) => Literal(value) } diff --git a/tests/neg/i1662.scala b/tests/neg/i1662.scala new file mode 100644 index 000000000000..1f9d02ba660b --- /dev/null +++ b/tests/neg/i1662.scala @@ -0,0 +1,6 @@ +class Lift { + def apply(f: F0) // error + class F0 + object F0 { implicit def f2f0(String): F0 = ??? } // error + (new Lift)("") +}