File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
compiler/src/dotty/tools/backend/sjs Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2932,7 +2932,11 @@ class JSCodeGen()(using genCtx: Context) {
29322932 case TYPEOF =>
29332933 // js.typeOf(arg)
29342934 val arg = genArgs1
2935- genAsInstanceOf(js.JSUnaryOp (js.JSUnaryOp .typeof, arg), defn.StringType )
2935+ val typeofExpr = arg match {
2936+ case arg : js.JSGlobalRef => js.JSTypeOfGlobalRef (arg)
2937+ case _ => js.JSUnaryOp (js.JSUnaryOp .typeof, arg)
2938+ }
2939+ js.AsInstanceOf (typeofExpr, jstpe.ClassType (jsNames.BoxedStringClass ))
29362940
29372941 case STRICT_EQ =>
29382942 // js.special.strictEquals(arg1, arg2)
Original file line number Diff line number Diff line change @@ -1009,6 +1009,12 @@ object Build {
10091009 scalaJSLinkerConfig ~= { _.withSemantics(build.TestSuiteLinkerOptions .semantics _) },
10101010 scalaJSModuleInitializers in Test ++= build.TestSuiteLinkerOptions .moduleInitializers,
10111011
1012+ jsEnvInput in Test := {
1013+ val resourceDir = fetchScalaJSSource.value / " test-suite/js/src/test/resources"
1014+ val f = (resourceDir / " NonNativeJSTypeTestNatives.js" ).toPath
1015+ org.scalajs.jsenv.Input .Script (f) +: (jsEnvInput in Test ).value
1016+ },
1017+
10121018 managedSources in Compile ++= {
10131019 val dir = fetchScalaJSSource.value / " test-suite/js/src/main/scala"
10141020 val filter = (
@@ -1049,7 +1055,6 @@ object Build {
10491055 -- " ExportsTest.scala" // JS exports
10501056 -- " IterableTest.scala" // non-native JS classes
10511057 -- " JSExportStaticTest.scala" // JS exports
1052- -- " JSNativeInPackage.scala" // #9785 tests fail due to js.typeOf(globalVar) being incorrect
10531058 -- " JSOptionalTest.scala" // non-native JS classes
10541059 -- " JSSymbolTest.scala" // non-native JS classes
10551060 -- " MiscInteropTest.scala" // non-native JS classes
You can’t perform that action at this time.
0 commit comments