Skip to content

Commit 13c335f

Browse files
johnniwintherCommit Queue
authored and
Commit Queue
committed
[cfe] Add test for issue 53751
Closes #53751 Change-Id: I4b0a081ff904b2e2b097d47aaa09a04c8795e105 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335045 Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Johnni Winther <[email protected]>
1 parent f962700 commit 13c335f

9 files changed

+129
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by b
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
extension type const E(int? n) {}
6+
const E e = null as E;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = #C1;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */ {
12+
lowered final self::E /* = core::int? */ #this = n;
13+
return #this;
14+
}
15+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
16+
return self::E|constructor#(n);
17+
18+
constants {
19+
#C1 = null
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = #C1;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */ {
12+
lowered final self::E /* = core::int? */ #this = n;
13+
return #this;
14+
}
15+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
16+
return self::E|constructor#(n);
17+
18+
constants {
19+
#C1 = null
20+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
extension type const E(int? n) {}
2+
const E e = null as E;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const E e = null as E;
2+
extension type const E(int? n) {}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = #C1;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */ {
12+
lowered final self::E /* = core::int? */ #this = n;
13+
return #this;
14+
}
15+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
16+
return self::E|constructor#(n);
17+
18+
constants {
19+
#C1 = null
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = #C1;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */ {
12+
lowered final self::E /* = core::int? */ #this = n;
13+
return #this;
14+
}
15+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
16+
return self::E|constructor#(n);
17+
18+
constants {
19+
#C1 = null
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = null as self::E /* = core::int? */;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */
12+
;
13+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
14+
return self::E|constructor#(n);
15+
16+
17+
Extra constant evaluation status:
18+
Evaluated: AsExpression @ org-dartlang-testcase:///issue53751.dart:6:18 -> NullConstant(null)
19+
Extra constant evaluation: evaluated: 3, effectively constant: 1
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
extension type E(core::int? n) {
6+
abstract extension-type-member representation-field get n() → core::int?;
7+
constructor • = self::E|constructor#;
8+
constructor tearoff • = self::E|constructor#_#new#tearOff;
9+
}
10+
static const field self::E /* = core::int? */ e = #C1;
11+
static extension-type-member method E|constructor#(core::int? n) → self::E /* = core::int? */ {
12+
lowered final self::E /* = core::int? */ #this = n;
13+
return #this;
14+
}
15+
static extension-type-member method E|constructor#_#new#tearOff(core::int? n) → self::E /* = core::int? */
16+
return self::E|constructor#(n);
17+
18+
constants {
19+
#C1 = null
20+
}

0 commit comments

Comments
 (0)