mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Add more data for CastError in _ContextTypeVisitor.
Bug: https://github.com/dart-lang/sdk/issues/48965 Change-Id: I50ac5baef607071f5b32df4aa63fb4327645a781 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243840 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
25c3f36d95
commit
838b68914f
|
@ -824,7 +824,18 @@ Class: ${parent.parent}
|
|||
@override
|
||||
DartType? visitListLiteral(ListLiteral node) {
|
||||
if (range.endStart(node.leftBracket, node.rightBracket).contains(offset)) {
|
||||
return (node.staticType as InterfaceType).typeArguments[0];
|
||||
final type = node.staticType;
|
||||
// TODO(scheglov) https://github.com/dart-lang/sdk/issues/48965
|
||||
if (type == null) {
|
||||
throw '''
|
||||
No type.
|
||||
node: $node
|
||||
parent: ${node.parent}
|
||||
parent2: ${node.parent?.parent}
|
||||
parent3: ${node.parent?.parent?.parent}
|
||||
''';
|
||||
}
|
||||
return (type as InterfaceType).typeArguments[0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue