| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/extension_types/issue54293.dart:16:9: Error: A value of type 'int' can't be assigned to a variable of type 'Int'. |
| // b = a + b; /* Error */ |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| extension type Int(core::int i) implements core::int { |
| abstract extension-type-member representation-field get i() → core::int; |
| operator + = self::Int|+; |
| constructor • = self::Int|constructor#; |
| constructor tearoff • = self::Int|constructor#_#new#tearOff; |
| } |
| static extension-type-member method Int|constructor#(core::int i) → self::Int /* erasure=core::int */ { |
| lowered final self::Int /* erasure=core::int */ #this = i; |
| return #this; |
| } |
| static extension-type-member method Int|constructor#_#new#tearOff(core::int i) → self::Int /* erasure=core::int */ |
| return self::Int|constructor#(i); |
| static extension-type-member method Int|+(lowered final self::Int /* erasure=core::int */ #this, core::int other) → self::Int /* erasure=core::int */ { |
| return self::Int|constructor#((#this as{Unchecked} core::int).{core::num::+}(other){(core::num) → core::int}); |
| } |
| static method test() → void { |
| core::int a = 2; |
| self::Int /* erasure=core::int */ b = self::Int|constructor#(8); |
| b = self::Int|+(b, a); |
| b = invalid-expression "pkg/front_end/testcases/extension_types/issue54293.dart:16:9: Error: A value of type 'int' can't be assigned to a variable of type 'Int'. |
| b = a + b; /* Error */ |
| ^" in a.{core::num::+}(b){(core::num) → core::int} as{TypeError} self::Int /* erasure=core::int */; |
| a = a.{core::num::+}(b){(core::num) → core::int}; |
| core::print(a.{core::num::+}(b){(core::num) → core::int}); |
| } |