Skip to content

Commit 036128c

Browse files
authored
Merge pull request #6105 from dotty-staging/fix-#6056
Fix #6056: Handle illegal input when determining import infos.
2 parents 7e16aca + 9830175 commit 036128c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

compiler/src/dotty/tools/dotc/typer/ImportInfo.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ class ImportInfo(symf: Context => Symbol, val selectors: List[untpd.Tree],
4747
private[this] var mySym: Symbol = _
4848

4949
/** The (TermRef) type of the qualifier of the import clause */
50-
def site(implicit ctx: Context): Type = {
51-
val ImportType(expr) = sym.info
52-
expr.tpe
50+
def site(implicit ctx: Context): Type = sym.info match {
51+
case ImportType(expr) => expr.tpe
52+
case _ => NoType
5353
}
5454

5555
/** The names that are excluded from any wildcard import */

tests/neg/i6056.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object i0{
2+
import i0.i0 // error
3+
def i0={
4+
import _ // error // error
5+
import // error
6+
} // error
7+
}

0 commit comments

Comments
 (0)