File tree 4 files changed +36
-1
lines changed
4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,16 @@ object language {
4
4
5
5
class Feature
6
6
7
+ /** Enable scala.Dynamic */
8
+ val dynamics = new Feature
9
+
7
10
/** Keep union types */
8
11
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
+
9
19
}
Original file line number Diff line number Diff line change @@ -271,6 +271,19 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisTran
271
271
case tpe => tpe
272
272
}
273
273
)
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)
274
287
case tree =>
275
288
super .transform(tree)
276
289
}
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 {
10
10
}
11
11
12
12
object TestNoAutoTupling {
13
- import language .noAutoTupling // try with on and off
13
+ import dotty . language .noAutoTupling // try with on and off
14
14
15
15
implicit def AToRichA (a : A ): RichA = new RichA
16
16
You can’t perform that action at this time.
0 commit comments