File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package dotty.tools
22package dotc
33package typer
44
5+ import backend .sjs .JSDefinitions
56import core ._
67import ast ._
78import Trees ._
@@ -219,7 +220,13 @@ class Typer extends Namer
219220 denot = denot.filterWithPredicate { mbr =>
220221 mbr.matchesImportBound(if mbr.symbol.is(Given ) then imp.givenBound else imp.wildcardBound)
221222 }
222- if reallyExists(denot) then
223+ def isScalaJsPseudoUnion =
224+ denot.name == tpnme.raw.BAR && ctx.settings.scalajs.value && denot.symbol == JSDefinitions .jsdefn.PseudoUnionClass
225+ // Just like Scala2Unpickler reinterprets Scala.js pseudo-unions
226+ // as real union types, we want references to `A | B` in sources
227+ // to be typed as a real union even if `js.|` has been imported,
228+ // so we ignore that import.
229+ if reallyExists(denot) && ! isScalaJsPseudoUnion then
223230 if unimported.isEmpty || ! unimported.contains(pre.termSymbol) then
224231 return pre.select(name, denot)
225232 case _ =>
You can’t perform that action at this time.
0 commit comments