Skip to content

A runtime error in a patterns test that requires operators > and <= on a String #1629

@chloestefantsova

Description

@chloestefantsova

The following line in a patterns test results in a runtime error.

Expect.isFalse(matches(["1", 3]));

The failure happens when the list literal from that line is checked agains a pattern in another line.

As I understand it, an object with the runtime type String is passed as an element of the list of static type List<dynamic>. The process of matching against the pattern invokes operator < on the object, which a String doesn't have. It results in an error.

The stack trace is as follows:

stderr:
Unhandled exception:
NoSuchMethodError: Class 'String' has no instance method '>'.
Receiver: "1"
Tried calling: >(0)
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1      matches (file:///b/s/w/ir/tests/co19/src/LanguageFeatures/Patterns/logical_and_A01_t02.dart)
#2      main (file:///b/s/w/ir/tests/co19/src/LanguageFeatures/Patterns/logical_and_A01_t02.dart:34:18)
#3      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#4      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:192:26)

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