mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 01:14:16 +00:00
Remove type cast in completion to prevent exception
Change-Id: If97adc54523894a3b9df241ffb0308ee1299d03d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372020 Reviewed-by: Keerti Parthasarathy <keertip@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
3b5065b49e
commit
1e5f96514c
|
@ -1144,11 +1144,14 @@ class DeclarationHelper {
|
|||
);
|
||||
}
|
||||
}
|
||||
_addExtensionMembers(
|
||||
type: element.thisType as InterfaceType,
|
||||
excludedGetters: {},
|
||||
includeMethods: true,
|
||||
includeSetters: true);
|
||||
var thisType = element.thisType;
|
||||
if (thisType is InterfaceType) {
|
||||
_addExtensionMembers(
|
||||
type: thisType,
|
||||
excludedGetters: {},
|
||||
includeMethods: true,
|
||||
includeSetters: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// Completion is inside [declaration].
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../../../client/completion_driver_test.dart';
|
||||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(FunctionInvocationTest);
|
||||
});
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class FunctionInvocationTest extends AbstractCompletionDriverTest
|
||||
with FunctionInvocationTestCases {}
|
||||
|
||||
mixin FunctionInvocationTestCases on AbstractCompletionDriverTest {
|
||||
Future<void> test_implicitCall() async {
|
||||
await computeSuggestions('''
|
||||
extension E<T> on Comparator<T> {
|
||||
Comparator<T> get inverse => (T a0, T b0) => this(^);
|
||||
}
|
||||
''');
|
||||
// TODO(brianwilkerson): `super` should not be suggested here.
|
||||
assertResponse(r'''
|
||||
suggestions
|
||||
a0
|
||||
kind: parameter
|
||||
b0
|
||||
kind: parameter
|
||||
true
|
||||
kind: keyword
|
||||
false
|
||||
kind: keyword
|
||||
null
|
||||
kind: keyword
|
||||
this
|
||||
kind: keyword
|
||||
const
|
||||
kind: keyword
|
||||
super
|
||||
kind: keyword
|
||||
switch
|
||||
kind: keyword
|
||||
''');
|
||||
}
|
||||
}
|
|
@ -33,6 +33,7 @@ import 'for_element_test.dart' as for_element;
|
|||
import 'for_statement_test.dart' as for_statement;
|
||||
import 'function_declaration_test.dart' as function_declaration;
|
||||
import 'function_expression_test.dart' as function_expression;
|
||||
import 'function_invocation_test.dart' as function_invocation;
|
||||
import 'if_element_test.dart' as if_element;
|
||||
import 'if_statement_test.dart' as if_statement;
|
||||
import 'implements_clause_test.dart' as implements_clause;
|
||||
|
@ -112,6 +113,7 @@ void main() {
|
|||
for_statement.main();
|
||||
function_declaration.main();
|
||||
function_expression.main();
|
||||
function_invocation.main();
|
||||
if_element.main();
|
||||
if_statement.main();
|
||||
implements_clause.main();
|
||||
|
|
Loading…
Reference in a new issue