Skip to content

Commit 57ccfcc

Browse files
authored
Skip String Literals in Typechecking (#89)
1 parent d906b45 commit 57ccfcc

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package testSuite;
2+
3+
public class CorrectStringConcat {
4+
5+
void example() {
6+
System.out.println("Hello, " + "World!");
7+
}
8+
}

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/general_checkers/OperationsChecker.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ public <T> void getBinaryOpRefinements(CtBinaryOperator<T> operator) throws Pars
8787
operator.putMetadata(rtc.REFINE_KEY, Predicate.createEquals(Predicate.createVar(rtc.WILD_VAR), oper));
8888
} else if (types.contains(type)) {
8989
operator.putMetadata(rtc.REFINE_KEY, Predicate.createEquals(Predicate.createVar(rtc.WILD_VAR), oper));
90+
} else if (type.equals("java.lang.String")) {
91+
// skip strings
9092
} else {
9193
throw new NotImplementedException("Literal type not implemented");
9294
}
@@ -238,6 +240,10 @@ private Predicate getOperationRefinements(CtBinaryOperator<?> operator, CtVariab
238240

239241
} else if (element instanceof CtLiteral<?>) {
240242
CtLiteral<?> l = (CtLiteral<?>) element;
243+
if (l.getType().getQualifiedName().equals("java.lang.String")) {
244+
// skip strings
245+
return new Predicate();
246+
}
241247
return new Predicate(l.getValue().toString(), element, rtc.getErrorEmitter());
242248

243249
} else if (element instanceof CtInvocation<?>) {

0 commit comments

Comments
 (0)