-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work oncfe-expression-compilationIssues related to expression compilation in the CFEIssues related to expression compilation in the CFElegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.triagedIssue has been triaged by sub teamIssue has been triaged by sub teamtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Repro below (I could not find a way to remove more code than this).
import 'dart:typed_data';
void main() {
var b = B(0);
var list = [b];
b.value2;
list.forEach((b) {
print(b.value2);
});
}
extension type A._(Uint8List i) {
A(int i) : this._(Uint8List.fromList([i]));
int get value => i.elementAt(0);
}
extension type B._(A i) implements A {
B(int i) : this._(A(i));
bool get value2 => i.value == 0;
}Steps:
- In the above code, place a breakpoint on line 6 (
b.value2) and line 8 (inside the closure) - Debug and add to watch
b.value2 - On the first break, you'll see
trueas the result (as expected). - On the second break, this is the output for expression evaluation:
Unhandled exception:
NoSuchMethodError: Class 'int' has no instance method 'elementAt'.
Receiver: 274334218320
Tried calling: elementAt(0)
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
#1 A.value (package:bug/bug.dart:15:22)
#2 B.value2 (package:bug/bug.dart:21:24)
#3 Eval ()
#4 main.<anonymous closure> (package:bug/bug.dart:8:13)
#5 List.forEach (dart:core-patch/growable_array.dart:417:8)
#6 main (package:bug/bug.dart:7:8)
#7 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#8 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)CC @DanTup
cleberlz
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work oncfe-expression-compilationIssues related to expression compilation in the CFEIssues related to expression compilation in the CFElegacy-area-front-endLegacy: Use area-dart-model instead.Legacy: Use area-dart-model instead.triagedIssue has been triaged by sub teamIssue has been triaged by sub teamtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)