Skip to content

Commit 1bd5034

Browse files
committed
[sdk] Update Isolate.debugName patch to match origin
Closes #48090 Change-Id: I18aa27ee73bbda2f4d4a0125084c9e9a041d7af6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226682 Reviewed-by: Lasse Nielsen <[email protected]>
1 parent 7dcd2ba commit 1bd5034

8 files changed

+97
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
import 'dart:isolate';
6+
7+
void main() {
8+
String debugName = Isolate.current.debugName ?? ''; // ok
9+
}
10+
11+
void test() {
12+
String debugName = Isolate.current.debugName; // error
13+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import 'dart:isolate';
2+
3+
void main() {}
4+
void test() {}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import 'dart:isolate';
2+
3+
void main() {}
4+
void test() {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
6+
// String debugName = Isolate.current.debugName; // error
7+
// ^
8+
//
9+
import self as self;
10+
import "dart:core" as core;
11+
import "dart:isolate" as iso;
12+
13+
import "dart:isolate";
14+
15+
static method main() → void {
16+
core::String debugName = let final core::String? #t1 = iso::Isolate::current.{iso::Isolate::debugName}{core::String?} in #t1 == null ?{core::String} "" : #t1{core::String};
17+
}
18+
static method test() → void {
19+
core::String debugName = invalid-expression "pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
20+
String debugName = Isolate.current.debugName; // error
21+
^" in iso::Isolate::current.{iso::Isolate::debugName}{core::String?} as{TypeError,ForNonNullableByDefault} core::String;
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
6+
// String debugName = Isolate.current.debugName; // error
7+
// ^
8+
//
9+
import self as self;
10+
import "dart:core" as core;
11+
import "dart:isolate" as iso;
12+
13+
import "dart:isolate";
14+
15+
static method main() → void {
16+
core::String debugName = let final core::String? #t1 = iso::Isolate::current.{iso::Isolate::debugName}{core::String?} in #t1 == null ?{core::String} "" : #t1{core::String};
17+
}
18+
static method test() → void {
19+
core::String debugName = invalid-expression "pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
20+
String debugName = Isolate.current.debugName; // error
21+
^" in iso::Isolate::current.{iso::Isolate::debugName}{core::String?} as{TypeError,ForNonNullableByDefault} core::String;
22+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
library /*isNonNullableByDefault*/;
2+
import self as self;
3+
4+
import "dart:isolate";
5+
6+
static method main() → void
7+
;
8+
static method test() → void
9+
;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
library /*isNonNullableByDefault*/;
2+
//
3+
// Problems in library:
4+
//
5+
// pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
6+
// String debugName = Isolate.current.debugName; // error
7+
// ^
8+
//
9+
import self as self;
10+
import "dart:core" as core;
11+
import "dart:isolate" as iso;
12+
13+
import "dart:isolate";
14+
15+
static method main() → void {
16+
core::String debugName = let final core::String? #t1 = iso::Isolate::current.{iso::Isolate::debugName}{core::String?} in #t1 == null ?{core::String} "" : #t1{core::String};
17+
}
18+
static method test() → void {
19+
core::String debugName = invalid-expression "pkg/front_end/testcases/general/issue48090.dart:12:38: Error: A value of type 'String?' can't be assigned to a variable of type 'String' because 'String?' is nullable and 'String' isn't.
20+
String debugName = Isolate.current.debugName; // error
21+
^" in iso::Isolate::current.{iso::Isolate::debugName}{core::String?};
22+
}

sdk/lib/_internal/vm/lib/isolate_patch.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ class Isolate {
312312
static Isolate get current => _currentIsolate;
313313

314314
@patch
315-
String get debugName => _getDebugName(controlPort);
315+
String? get debugName => _getDebugName(controlPort);
316316

317317
@patch
318318
static Future<Uri?> get packageRoot {

0 commit comments

Comments
 (0)