mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-24 10:30:54 +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) {
|
||||
tokens.expectValue('(');
|
||||
const e = expression(tokens, locals, method, imports, typemap);
|
||||
if (e.variables[0] && e.variables[0].type.typeSignature !== 'Z') {
|
||||
addproblem(tokens, ParseProblem.Error(tokens.current, `Type of expression must be boolean`));
|
||||
if (e.variables[0] && !isTypeAssignable(PrimitiveType.map.Z, e.variables[0].type)) {
|
||||
addproblem(tokens, ParseProblem.Error(tokens.current, `Boolean expression expected, but type '${e.variables[0].type.fullyDottedTypeName}' found`));
|
||||
}
|
||||
tokens.expectValue(')');
|
||||
return e;
|
||||
|
||||
Reference in New Issue
Block a user