Skip to content
Snippets Groups Projects
Verified Commit c4129b1d authored by Recolic Keghart's avatar Recolic Keghart
Browse files

if-bug fix

parent d4816436
No related branches found
No related tags found
No related merge requests found
Pipeline #43 passed with warnings with stages
in 2 minutes and 48 seconds
......@@ -328,8 +328,12 @@ public class TypeChecker extends AbstractNodeAnalyzer<SymbolType> {
@Override
public SymbolType analyze(IfExpr node) {
SymbolType condition_type = node.condition.dispatch(this);
SymbolType then_type = node.thenExpr.dispatch(this);
SymbolType else_type = node.elseExpr.dispatch(this);
if(!condition_type.equals(BOOL_TYPE)) {
err(node, "if_expr should have BOOL_TYPE");
}
if(!then_type.equals(else_type)) {
err(node, "then_type not equals to else_type. ");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment