mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2026-01-02 23:06:33 +00:00
use isTypeAssignable for checking branch test expressions
This commit is contained in:
@@ -347,8 +347,8 @@ function statementKeyword(tokens, locals, method, imports, typemap) {
|
|||||||
function bracketedTest(tokens, locals, method, imports, typemap) {
|
function bracketedTest(tokens, locals, method, imports, typemap) {
|
||||||
tokens.expectValue('(');
|
tokens.expectValue('(');
|
||||||
const e = expression(tokens, locals, method, imports, typemap);
|
const e = expression(tokens, locals, method, imports, typemap);
|
||||||
if (e.variables[0] && e.variables[0].type.typeSignature !== 'Z') {
|
if (e.variables[0] && !isTypeAssignable(PrimitiveType.map.Z, e.variables[0].type)) {
|
||||||
addproblem(tokens, ParseProblem.Error(tokens.current, `Type of expression must be boolean`));
|
addproblem(tokens, ParseProblem.Error(tokens.current, `Boolean expression expected, but type '${e.variables[0].type.fullyDottedTypeName}' found`));
|
||||||
}
|
}
|
||||||
tokens.expectValue(')');
|
tokens.expectValue(')');
|
||||||
return e;
|
return e;
|
||||||
|
|||||||
Reference in New Issue
Block a user