[DAS] Fixes switch_on_type for dynamic
Fixes: https://github.com/dart-lang/sdk/issues/61355 Change-Id: I306e825a20a93910a72c3208596f6d21d82d1ef3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/445921 Auto-Submit: Felipe Morschel <git@fmorschel.dev> Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
@@ -69,7 +69,7 @@ class _Visitor extends SimpleAstVisitor<void> {
|
||||
|
||||
/// Returns `true` if the [type] is assignable to [Type].
|
||||
bool _isAssignableToType(DartType? type) {
|
||||
if (type == null) return false;
|
||||
if (type == null || type is DynamicType) return false;
|
||||
return context.typeSystem.isAssignableTo(type, _typeType);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,14 @@ void f(Type t) {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> test_dynamic() async {
|
||||
await assertNoDiagnostics('''
|
||||
void foo(dynamic a) {
|
||||
switch (a) {}
|
||||
}
|
||||
''');
|
||||
}
|
||||
|
||||
Future<void> test_functionToString() async {
|
||||
await assertNoDiagnostics('''
|
||||
void f() {
|
||||
|
||||
Reference in New Issue
Block a user