String msg = vi.varKey + " declared with two different sorts: " + s + " and " + vi.sort; KException kex = new KException(KException.ExceptionType.ERROR, KException.KExceptionGroup.CRITICAL, msg, loc.source().orElse(null), loc.location().orElse(null)); return simpleError(Sets.newHashSet(new VariableTypeClashException(kex))); assert fails != null; String msg = "Could not infer a sort for variable " + fails + " to match every location."; KException kex = new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, loc.source().orElse(null), loc.location().orElse(null)); return simpleError(Sets.newHashSet(new VariableTypeClashException(kex))); msg += " " + v; KException kex = new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, loc.source().orElse(null), loc.location().orElse(null)); return simpleError(Sets.newHashSet(new ParseFailedException(kex))); msg += vv1 + ", "; msg = msg.substring(0, msg.length() - 2); KException kex = new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, loc.source().orElse(null), loc.location().orElse(null)); return simpleError(Sets.newHashSet(new VariableTypeClashException(kex))); KException kex = new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, loc.source().orElse(null), loc.location().orElse(null)); return simpleError(Sets.newHashSet(new VariableTypeClashException(kex))); } else { String msg = "Variable " + key + " was not declared. Assuming sort " + sort + "."; warnings.add(new VariableTypeClashException( new KException(ExceptionType.HIDDENWARNING, KExceptionGroup.COMPILER, msg, loc.source().orElse(null), loc.location().orElse(null))));