Skip to content

Commit

Permalink
[jvm] please our Dynamic overlords
Browse files Browse the repository at this point in the history
closes #8872
  • Loading branch information
Simn authored and RealyUniqueName committed Oct 31, 2019
1 parent a239449 commit d2bba9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/generators/genjvm.ml
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,8 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
method expect_reference_type = jm#expect_reference_type

method cast t =
if follow t != t_dynamic then begin
let vt = self#vtype t in
jm#cast vt
end else
self#expect_reference_type
let vt = self#vtype t in
jm#cast vt

method cast_expect ret t = match ret with
| RValue (Some jsig) -> jm#cast jsig
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/src/unit/issues/Issue8872.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package unit.issues;

class Issue8872 extends unit.Test {
function test() {
var d:Array<Dynamic> = [];
d.push(getTrue() ? (0 : Dynamic) : ("foo" : Dynamic));
eq(0, d[0]);
}

static function getTrue() {
return true;
}
}

0 comments on commit d2bba9a

Please sign in to comment.