Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress follow-on errors for erroneous import qualifiers #16658

Merged
merged 1 commit into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ trait Checking {

/** Check that type `tp` is stable. */
def checkStable(tp: Type, pos: SrcPos, kind: String)(using Context): Unit =
if !tp.isStable then report.error(NotAPath(tp, kind), pos)
if !tp.isStable && !tp.isErroneous then report.error(NotAPath(tp, kind), pos)

/** Check that all type members of `tp` have realizable bounds */
def checkRealizableBounds(cls: Symbol, pos: SrcPos)(using Context): Unit = {
Expand Down Expand Up @@ -904,7 +904,7 @@ trait Checking {
private def checkLegalImportOrExportPath(path: Tree, kind: String)(using Context): Unit = {
checkStable(path.tpe, path.srcPos, kind)
if (!ctx.isAfterTyper) Checking.checkRealizable(path.tpe, path.srcPos)
if !isIdempotentExpr(path) then
if !isIdempotentExpr(path) && !path.tpe.isErroneous then
report.error(em"import prefix is not a pure expression", path.srcPos)
}

Expand Down
6 changes: 6 additions & 0 deletions tests/neg/i16653.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- [E006] Not Found Error: tests/neg/i16653.scala:1:7 ------------------------------------------------------------------
1 |import demo.implicits._ // error
| ^^^^
| Not found: demo
|
| longer explanation available when compiling with `-explain`
3 changes: 3 additions & 0 deletions tests/neg/i16653.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import demo.implicits._ // error
import demo._
object Demo {}
2 changes: 1 addition & 1 deletion tests/neg/i6056.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ object i0{
import i0.i0 // error // error
def i0={
import _ // error
import // error
import
} // error
}
2 changes: 1 addition & 1 deletion tests/neg/parser-stability-9.scala
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import // error
import
// error