diff --git a/src/java/com/claro/intermediate_representation/statements/StmtListNode.java b/src/java/com/claro/intermediate_representation/statements/StmtListNode.java index 34d20bb3..e3cadb86 100644 --- a/src/java/com/claro/intermediate_representation/statements/StmtListNode.java +++ b/src/java/com/claro/intermediate_representation/statements/StmtListNode.java @@ -42,8 +42,7 @@ public void assertExpectedExprTypes(ScopedHeap scopedHeap) throws ClaroTypeExcep // TODO(steving) Find some way to make this assertion in the CUP parsing phase itself. Once we start // implementing better error messages with line numbers etc, I get a feeling that // throwing this manner of error here will make it hard to get line numbers right. - throw new ClaroParserException( - "Unreachable statements following a return/break stmt are not allowed." + curr.getChildren().get(0)); + throw new ClaroParserException("Unreachable statements following a return/break stmt are not allowed."); } Stmt currStmt = ((Stmt) curr.getChildren().get(0)); diff --git a/src/java/com/claro/intermediate_representation/statements/contracts/ContractDefinitionStmt.java b/src/java/com/claro/intermediate_representation/statements/contracts/ContractDefinitionStmt.java index 4fc93803..ecb1c9a9 100644 --- a/src/java/com/claro/intermediate_representation/statements/contracts/ContractDefinitionStmt.java +++ b/src/java/com/claro/intermediate_representation/statements/contracts/ContractDefinitionStmt.java @@ -679,8 +679,11 @@ private StringBuilder generateDynamicDispatchHelperForContractProcedure(String p .requiredContextualOutputTypeAssertionTypeParamNames .contains(this.typeParamNames.get(n)) || - this.contractProceduresSupportingDynamicDispatchOverArgsWhenGenericReturnTypeInferenceRequired - .get(procedureName).values().stream().anyMatch(i -> n == i)) { + Optional.ofNullable( + this.contractProceduresSupportingDynamicDispatchOverArgsWhenGenericReturnTypeInferenceRequired + .get(procedureName)) + .map(m -> m.values().stream().anyMatch(i -> n == i)) + .orElse(false)) { return String.format("$%s_vtableKey", this.typeParamNames.get(n)); } Type onlyConcreteTypeForCurrTypeParam =