Skip to content

Possibly unintended runtime error in patterns tests #1896

@chloestefantsova

Description

@chloestefantsova

In the following tests the first positional argument to the invocations of getType is cast to the inferred type argument of the invocation. However, the type of the first formal positional parameter of getType is Object?, which leads to a difference between the inferred type argument to getType and the inferred type argument to [] passed as the first positional argument.

var <B>[A v1, B v2, v3] = getType([], (String s) {log += s;});

The stack trace is as follows:

stderr:
Unhandled exception:
type 'List<dynamic>' is not a subtype of type 'List<C>' in type cast
#0      getType (file:///b/s/w/ir/tests/co19/src/LanguageFeatures/Patterns/patterns_lib.dart:47:12)
#1      main (file:///b/s/w/ir/tests/co19/src/LanguageFeatures/Patterns/type_inference_A07_t01.dart:64:15)
#2      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#3      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)

Another similar case is the following:

var <String, C>{} = getType({}, (String s) {log += s;});

Metadata

Metadata

Assignees

Labels

bad-testReport tests in need of updates. When closed, the tests should be considered good

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions