8000 Properly type js.If in statement position · scala-js/scala-js@83606a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83606a2

Browse files
committed
Properly type js.If in statement position
1 parent b641735 commit 83606a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/src/main/scala/org/scalajs/nscplugin/GenJSCode.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,8 +2312,12 @@ abstract class GenJSCode[G <: Global with Singleton](val global: G)
23122312
}
23132313

23142314
case If(cond, thenp, elsep) =>
2315+
val tpe =
2316+
if (isStat) jstpe.NoType
2317+
else toIRType(tree.tpe)
2318+
23152319
js.If(genExpr(cond), genStatOrExpr(thenp, isStat),
2316-
genStatOrExpr(elsep, isStat))(toIRType(tree.tpe))
2320+
genStatOrExpr(elsep, isStat))(tpe)
23172321

23182322
case Return(expr) =>
23192323
js.Return(toIRType(expr.tpe) match {

0 commit comments

Comments
 (0)
0