asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 148 forks source link

Conditional expression validation should consider subtypes of int/double #114

Closed gasman closed 9 years ago

gasman commented 9 years ago

Validation of ConditionalExpression currently rejects some valid cases, because it expects the consequent and alternate expressions to match the Int or Double type exactly; as per http://asmjs.org/spec/latest/#conditionalexpression, it should accept any subtype of Int / Double.

This PR corrects the logic so that the two expressions must either be both subtypes of Int, OR both subtypes of Double.

sunfishcode commented 9 years ago

Looks right. Thanks!