Test currently fails on both DDC and dart2js

Bug: 51527
Change-Id: I229d5c9ba518d3323f98312f13740711523439e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290350
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This commit is contained in:
Stephen Adams 2023-03-22 20:09:03 +00:00 committed by Commit Queue
parent 8e055884c5
commit 7675d887b3
2 changed files with 66 additions and 0 deletions

View file

@ -0,0 +1,33 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Regression test for http://dartbug.com/51527
import 'package:expect/expect.dart';
void noop() {}
dynamic makeNull() => null;
String test(String? o) {
switch (o) {
case null:
return 'NULL';
case 'one':
return '1';
default:
return o;
}
}
void main() {
final String? s1 = 'one';
final String? s2 = 'two';
final String? s3 = Function.apply(makeNull, []);
final String? s4 = Function.apply(noop, []);
Expect.equals('1', test(s1));
Expect.equals('two', test(s2));
Expect.equals('NULL', test(s3));
Expect.equals('NULL', test(s4));
}

View file

@ -0,0 +1,33 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Regression test for http://dartbug.com/51527
import 'package:expect/expect.dart';
void noop() {}
dynamic makeNull() => null;
String test(String o) {
switch (o) {
case null:
return 'NULL';
case 'one':
return '1';
default:
return o;
}
}
void main() {
final String s1 = 'one';
final String s2 = 'two';
final String s3 = Function.apply(makeNull, []);
final String s4 = Function.apply(noop, []);
Expect.equals('1', test(s1));
Expect.equals('two', test(s2));
Expect.equals('NULL', test(s3));
Expect.equals('NULL', test(s4));
}