Bladeren bron

Made ExpressionValidator messages for array type mismatches clearer

Now pritns the array element type and the faulty element's type
Also changed this for assoc Arrays
kindlich 5 jaren geleden
bovenliggende
commit
8349132e8e
Geen bekende sleutel gevonden voor deze handtekening in de database

+ 3
- 3
Validator/src/main/java/org/openzen/zenscript/validator/visitors/ExpressionValidator.java Bestand weergeven

60
 				validator.logError(
60
 				validator.logError(
61
 					ValidationLogEntry.Code.INVALID_OPERAND_TYPE,
61
 					ValidationLogEntry.Code.INVALID_OPERAND_TYPE,
62
 					expression.position,
62
 					expression.position,
63
-					"array element expression type doesn't match array type");
63
+					"array element expression type " + element.type + " doesn't match array type " + expression.arrayType.elementType);
64
 			}
64
 			}
65
 			element.accept(this);
65
 			element.accept(this);
66
 		}
66
 		}
383
 			key.accept(this);
383
 			key.accept(this);
384
 			value.accept(this);
384
 			value.accept(this);
385
 			if (!key.type.equals(type.keyType)) {
385
 			if (!key.type.equals(type.keyType)) {
386
-				validator.logError(ValidationLogEntry.Code.INVALID_OPERAND_TYPE, key.position, "Key type must match the associative array key type");
386
+				validator.logError(ValidationLogEntry.Code.INVALID_OPERAND_TYPE, key.position, "Key type " + key.type + " must match the associative array key type " + type.keyType);
387
 			}
387
 			}
388
 			if (!value.type.equals(type.valueType)) {
388
 			if (!value.type.equals(type.valueType)) {
389
-				validator.logError(ValidationLogEntry.Code.INVALID_OPERAND_TYPE, key.position, "Value type must match the associative array value type");
389
+				validator.logError(ValidationLogEntry.Code.INVALID_OPERAND_TYPE, key.position, "Value type " + value.type + " must match the associative array value type " + type.valueType);
390
 			}
390
 			}
391
 		}
391
 		}
392
 		return null;
392
 		return null;

Laden…
Annuleren
Opslaan