Skip to content

Fix #1662: Add missing case for singleton #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought SkolemType is only used for existential types, but it seems not to be the case. Could you briefly explain a little bit the usage of SkolemType, or add a comment to class SkolemType?

RecThis is also a SingletonType, I guess it can be safely ignored here.

case ConstantType(value) => Literal(value)
}
Expand Down
6 changes: 6 additions & 0 deletions tests/neg/i1662.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Lift {
def apply(f: F0) // error
class F0
object F0 { implicit def f2f0(String): F0 = ??? } // error
(new Lift)("")
}