Added FieldAccessInfo errors to hover info

This commit is contained in:
bigguy345 committed 2025-12-26 22:16:54 +02:00
1 parent 50165677c7
commit fc9c9e187e
2 files changed
+8 -2

No files matched your search

@@ -93,8 +93,9 @@ public class FieldAccessInfo {
if (expectedType != null && resolvedField != null) {
TypeInfo fieldType = resolvedField.getDeclaredType();
if (fieldType != null && !isTypeCompatible(fieldType, expectedType)) {
setError(ErrorType.TYPE_MISMATCH,
"Required type: " + expectedType.getSimpleName() + ", Provided: " + fieldType.getSimpleName());
//extra space is necessary for alignment
setError(ErrorType.TYPE_MISMATCH, "Provided type: " + fieldType.getSimpleName()+
"\nRequired: " + expectedType.getSimpleName());
}
}
}
@@ -171,6 +171,11 @@ public class TokenHoverInfo {
}
}
FieldAccessInfo fieldAccessInfo = token.getFieldAccessInfo();
if (fieldAccessInfo != null && fieldAccessInfo.hasError()) {
errors.add(fieldAccessInfo.getErrorMessage());
}
FieldInfo fieldInfo = token.getFieldInfo();
if (fieldInfo != null && !fieldInfo.isResolved()) {
errors.add("Cannot resolve symbol '" + token.getText() + "'");