File tree 2 files changed +29
-0
lines changed
src/dotty/tools/dotc/transform
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,23 @@ 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
+ def isDottyLanguageFeature = { // TODO Add new language features to scala.language
279
+ exprTpe =:= defn.Scala2LanguageModuleClass .typeRef &&
280
+ name == nme.noAutoTupling // or any other new feature
281
+ }
282
+ if (name != nme.WILDCARD && ! exprTpe.member(name).exists && ! exprTpe.member(name.toTypeName).exists && ! isDottyLanguageFeature)
283
+ ctx.error(s " ${ident.name} is not a member of ${expr.show}" , ident.pos)
284
+ }
285
+ selectors.foreach {
286
+ case ident : Ident => checkIdent(ident)
287
+ case Thicket ((ident : Ident ) :: _) => checkIdent(ident)
288
+ case _ =>
289
+ }
290
+ super .transform(tree)
274
291
case tree =>
275
292
super .transform(tree)
276
293
}
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
You can’t perform that action at this time.
0 commit comments