mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:47:36 +00:00
Improve the highlight range for non_sized_type_argument
Change-Id: I1c54df8e8f5c167fdb87053cca181cd52ee6f853 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213823 Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
parent
d6f0e39f30
commit
98d28c08ee
|
@ -701,8 +701,15 @@ class FfiVerifier extends RecursiveAstVisitor<void> {
|
|||
} else if (declaredType.isArray) {
|
||||
final typeArg = (declaredType as InterfaceType).typeArguments.single;
|
||||
if (!_isSized(typeArg)) {
|
||||
AstNode errorNode = fieldType;
|
||||
if (fieldType is TypeName) {
|
||||
var typeArguments = fieldType.typeArguments?.arguments;
|
||||
if (typeArguments != null && typeArguments.isNotEmpty) {
|
||||
errorNode = typeArguments[0];
|
||||
}
|
||||
}
|
||||
_errorReporter.reportErrorForNode(FfiCode.NON_SIZED_TYPE_ARGUMENT,
|
||||
fieldType, [_arrayClassName, typeArg.toString()]);
|
||||
errorNode, [_arrayClassName, typeArg]);
|
||||
}
|
||||
final arrayDimensions = declaredType.arrayDimensions;
|
||||
_validateSizeOfAnnotation(fieldType, annotations, arrayDimensions);
|
||||
|
|
|
@ -24,7 +24,7 @@ class C extends Struct {
|
|||
external Array<Void> a0;
|
||||
}
|
||||
''', [
|
||||
error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 68, 11),
|
||||
error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 74, 4),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class C extends Union {
|
|||
external Array<Void> a0;
|
||||
}
|
||||
''', [
|
||||
error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 67, 11),
|
||||
error(FfiCode.NON_SIZED_TYPE_ARGUMENT, 73, 4),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue