Skip to content

Commit 9581eb1

Browse files
committed
Scala.js: Consider js.| as a JS type.
1 parent 7a8ba54 commit 9581eb1

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
@@ -1074,15 +1074,13 @@ object Build {
10741074
++ (dir / "js/src/test/scala/org/scalajs/testsuite/javalib" ** (("*.scala": FileFilter)
10751075
-- "FormatterJSTest.scala" // compile error with the f"" interpolator
10761076
-- "ObjectJSTest.scala" // non-native JS classes
1077-
-- "StringBufferJSTest.scala" // IR checking errors
10781077
-- "ThrowableJSTest.scala" // test fails ("java.lang.Error: stub")
10791078
)).get
10801079

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

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

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

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

0 commit comments

Comments
 (0)