File tree Expand file tree Collapse file tree 4 files changed +36
-1
lines changed
Expand file tree Collapse file tree 4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,16 @@ object language {
44
55 class Feature
66
7+ /** Enable scala.Dynamic */
8+ val dynamics = new Feature
9+
710 /** Keep union types */
811 val keepUnions = new Feature
12+
13+ /** Disable auto tupling */
14+ val noAutoTupling = new Feature
15+
16+ /** Enable Scala 2 compatibility mode */
17+ val Scala2 = new Feature
18+
919}
Original file line number Diff line number Diff line change @@ -271,6 +271,19 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
271271 case tpe => tpe
272272 }
273273 )
274+ case Import (expr, selectors) =>
275+ val exprTpe = expr.tpe
276+ def checkIdent (ident : Ident ): Unit = {
277+ val name = ident.name.asTermName.encode
278+ if (name != nme.WILDCARD && ! exprTpe.member(name).exists && ! exprTpe.member(name.toTypeName).exists)
279+ ctx.error(s " ${ident.name} is not a member of ${expr.show}" , ident.pos)
280+ }
281+ selectors.foreach {
282+ case ident : Ident => checkIdent(ident)
283+ case Pair (ident : Ident , _) => checkIdent(ident)
284+ case _ =>
285+ }
286+ super .transform(tree)
274287 case tree =>
275288 super .transform(tree)
276289 }
Original file line number Diff line number Diff line change 1+ import scala .idontexist // error
2+ import scala .io .Idontexist // error
3+
4+ import scala .io
5+ import io .Idontexist2 // error
6+
7+ import scala .io .{ AnsiColor , Idontexist3 } // error
8+
9+ import scala .io .{ Idontexist4 => Foo } // error
10+ import scala .io .{ Idontexist5 => _ } // error
11+
12+ object Test
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class RichA {
1010}
1111
1212object TestNoAutoTupling {
13- import language .noAutoTupling // try with on and off
13+ import dotty . language .noAutoTupling // try with on and off
1414
1515 implicit def AToRichA (a : A ): RichA = new RichA
1616
You can’t perform that action at this time.
0 commit comments