Skip to content

Commit ad6623b

Browse files
committed
Scala.js: Consider js.| as a JS type.
1 parent c36c27d commit ad6623b

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

compiler/src/dotty/tools/backend/sjs/JSDefinitions.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ final class JSDefinitions()(using Context) {
4747
@threadUnsafe lazy val JSBaseThisFunctionType: TypeRef = requiredClassRef("scala.scalajs.js.ThisFunction")
4848
def JSBaseThisFunctionClass(using Context) = JSBaseThisFunctionType.symbol.asClass
4949

50+
@threadUnsafe lazy val PseudoUnionType: TypeRef = requiredClassRef("scala.scalajs.js.|")
51+
def PseudoUnionClass(using Context) = PseudoUnionType.symbol.asClass
52+
5053
@threadUnsafe lazy val JSArrayType: TypeRef = requiredClassRef("scala.scalajs.js.Array")
5154
def JSArrayClass(using Context) = JSArrayType.symbol.asClass
5255

compiler/src/dotty/tools/backend/sjs/JSInterop.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ object JSInterop {
1616

1717
/** Is this symbol a JavaScript type? */
1818
def isJSType(sym: Symbol)(using Context): Boolean = {
19-
//sym.hasAnnotation(jsdefn.RawJSTypeAnnot)
2019
atPhase(erasurePhase) {
21-
sym.derivesFrom(jsdefn.JSAnyClass)
20+
sym.derivesFrom(jsdefn.JSAnyClass) || sym == jsdefn.PseudoUnionClass
2221
}
2322
}
2423

project/Build.scala

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,15 +1075,13 @@ object Build {
10751075
++ (dir / "js/src/test/scala/org/scalajs/testsuite/javalib" ** (("*.scala": FileFilter)
10761076
-- "FormatterJSTest.scala" // compile error with the f"" interpolator
10771077
-- "ObjectJSTest.scala" // non-native JS classes
1078-
-- "StringBufferJSTest.scala" // IR checking errors
10791078
-- "ThrowableJSTest.scala" // test fails ("java.lang.Error: stub")
10801079
)).get
10811080

10821081
++ (dir / "js/src/test/scala/org/scalajs/testsuite/jsinterop" ** (("*.scala": FileFilter)
10831082
-- "AsyncTest.scala" // needs PromiseMock.scala
10841083
-- "DynamicTest.scala" // one test requires JS exports, all other tests pass
10851084
-- "ExportsTest.scala" // JS exports
1086-
-- "FunctionTest.scala" // IR checking errors
10871085
-- "IterableTest.scala" // non-native JS classes
10881086
-- "JSExportStaticTest.scala" // JS exports
10891087
-- "JSNativeInPackage.scala" // IR checking errors
@@ -1095,8 +1093,6 @@ object Build {
10951093
-- "NonNativeJSTypeTest.scala" // non-native JS classes
10961094
-- "PromiseMock.scala" // non-native JS classes
10971095
-- "SpecialTest.scala" // not yet implemented JS-specific primitive
1098-
-- "SymbolTest.scala" // IR checking errors
1099-
-- "UndefOrTest.scala" // StackOverflow in the compiler
11001096
)).get
11011097

11021098
++ (dir / "js/src/test/scala/org/scalajs/testsuite/junit" ** (("*.scala": FileFilter)
@@ -1112,7 +1108,6 @@ object Build {
11121108
-- "ObjectTest.scala" // compile errors
11131109
-- "StackTraceTest.scala" // would require `npm install source-map-support`
11141110
-- "UnionTypeTest.scala" // requires a Scala 2 macro + StackOverflow in the compiler
1115-
-- "WrappedDictionaryTest.scala" // IR checking errors
11161111
)).get
11171112

11181113
++ (dir / "js/src/test/scala/org/scalajs/testsuite/niobuffer" ** "*.scala").get
@@ -1128,9 +1123,7 @@ object Build {
11281123
-- "SAMJSTest.scala" // non-native JS classes
11291124
)).get
11301125

1131-
++ (dir / "js/src/test/scala-new-collections" ** (("*.scala": FileFilter)
1132-
-- "WrappedDictionaryToTest.scala" // IR checking errors
1133-
)).get
1126+
++ (dir / "js/src/test/scala-new-collections" ** "*.scala").get
11341127
)
11351128
}
11361129
)

0 commit comments

Comments
 (0)