Sfoglia il codice sorgente

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 anni fa
parent
commit
8349132e8e
Non sono state trovate chiavi note per questa firma nel database

+ 3
- 3
Validator/src/main/java/org/openzen/zenscript/validator/visitors/ExpressionValidator.java Vedi File

@@ -60,7 +60,7 @@ public class ExpressionValidator implements ExpressionVisitor<Void> {
60 60
 				validator.logError(
61 61
 					ValidationLogEntry.Code.INVALID_OPERAND_TYPE,
62 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 65
 			element.accept(this);
66 66
 		}
@@ -383,10 +383,10 @@ public class ExpressionValidator implements ExpressionVisitor<Void> {
383 383
 			key.accept(this);
384 384
 			value.accept(this);
385 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 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 392
 		return null;

Loading…
Annulla
Salva