diff options
author | Martin Odersky <odersky@gmail.com> | 2016-11-10 15:06:00 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-11-10 15:06:27 +0100 |
commit | 82e2ac52926846cebc1ec3a5b5aa4037eeecf93a (patch) | |
tree | 34d204c6484b8f5e7a2ec0f354b8954a61cb570b | |
parent | 28c2e04dd33b6389a44460f977a97b8691265994 (diff) | |
download | dotty-82e2ac52926846cebc1ec3a5b5aa4037eeecf93a.tar.gz dotty-82e2ac52926846cebc1ec3a5b5aa4037eeecf93a.tar.bz2 dotty-82e2ac52926846cebc1ec3a5b5aa4037eeecf93a.zip |
Fix #1662: Add missing case for singleton
Have to handle also SkolemTypes there.
Fixes #1662.
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 5 | ||||
-rw-r--r-- | tests/neg/i1662.scala | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index db2ce5649..fc96735b0 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 000000000..1f9d02ba6 --- /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)("") +} |