Skip to content

Commit 6990bb3

Browse files
authored
Merge pull request #1695 from dotty-staging/fix-#1662
Fix #1662: Add missing case for singleton
2 parents b8262a5 + 82e2ac5 commit 6990bb3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
306306
case _ =>
307307
false
308308
}
309-
typeIsElidable ||
310-
tp.symbol.is(JavaStatic) ||
309+
typeIsElidable ||
310+
tp.symbol.is(JavaStatic) ||
311311
tp.symbol.hasAnnotation(defn.ScalaStaticAnnot)
312312
}
313313

@@ -343,6 +343,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
343343
def singleton(tp: Type)(implicit ctx: Context): Tree = tp match {
344344
case tp: TermRef => ref(tp)
345345
case tp: ThisType => This(tp.cls)
346+
case tp: SkolemType => singleton(tp.narrow)
346347
case SuperType(qual, _) => singleton(qual)
347348
case ConstantType(value) => Literal(value)
348349
}

tests/neg/i1662.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Lift {
2+
def apply(f: F0) // error
3+
class F0
4+
object F0 { implicit def f2f0(String): F0 = ??? } // error
5+
(new Lift)("")
6+
}

0 commit comments

Comments
 (0)