Skip to content

Commit

Permalink
Don't explicitly check for error trees in export selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Nov 18, 2024
1 parent 74920d3 commit 6e28679
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ class Namer { typer: Typer =>
private def exportForwarders(exp: Export, pathMethod: Symbol)(using Context): List[tpd.MemberDef] =
val buf = new mutable.ListBuffer[tpd.MemberDef]
val Export(expr, selectors) = exp
if expr.isEmpty || selectors.exists(_.imported.name == nme.ERROR) then
if expr.isEmpty then
report.error(em"Export selector must have prefix and `.`", exp.srcPos)
return Nil

Expand Down
6 changes: 4 additions & 2 deletions tests/neg/i20511.check
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
8 |val i = 1 // error
|^^^
|'.' expected, but 'end of statement' found
-- Error: tests/neg/i20511.scala:7:21 ----------------------------------------------------------------------------------
-- [E083] Type Error: tests/neg/i20511.scala:7:21 ----------------------------------------------------------------------
7 |export toppingPrice, crustPrice // error // error
| ^^^^^^^^^^
| Export selector must have prefix and `.`
| Any is not a valid export prefix, since it is not an immutable path
|
| longer explanation available when compiling with `-explain`

0 comments on commit 6e28679

Please sign in to comment.