mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 23:59:47 +00:00
[tests] Add regression tests for identifiers
Issue: https://github.com/dart-lang/sdk/issues/52431 Issue: https://github.com/dart-lang/sdk/issues/39595 Change-Id: Iae9c02ad632264d1eb14fb0958f714b4faee55b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304262 Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
parent
327a680c34
commit
5091631de1
1
tests/language/regress/regress39595/false.dart
Normal file
1
tests/language/regress/regress39595/false.dart
Normal file
|
@ -0,0 +1 @@
|
|||
final fromFalse = 'from a library named "false"';
|
1
tests/language/regress/regress39595/null.dart
Normal file
1
tests/language/regress/regress39595/null.dart
Normal file
|
@ -0,0 +1 @@
|
|||
final fromNull = 'from a library named "null"';
|
19
tests/language/regress/regress39595/regress39595_test.dart
Normal file
19
tests/language/regress/regress39595/regress39595_test.dart
Normal file
|
@ -0,0 +1,19 @@
|
|||
// 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 https://github.com/dart-lang/sdk/issues/39595.
|
||||
///
|
||||
/// Libraries with the names 'true', 'false', and 'null' should not shadow
|
||||
/// those terms.
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'true.dart';
|
||||
import 'false.dart';
|
||||
import 'null.dart';
|
||||
|
||||
main() {
|
||||
Expect.equals('from a library named "true"', fromTrue);
|
||||
Expect.equals('from a library named "false"', fromFalse);
|
||||
Expect.equals('from a library named "null"', fromNull);
|
||||
}
|
1
tests/language/regress/regress39595/true.dart
Normal file
1
tests/language/regress/regress39595/true.dart
Normal file
|
@ -0,0 +1 @@
|
|||
final fromTrue = 'from a library named "true"';
|
37
tests/language/regress/regress52431_test.dart
Normal file
37
tests/language/regress/regress52431_test.dart
Normal file
|
@ -0,0 +1,37 @@
|
|||
// 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 https://github.com/dart-lang/sdk/issues/52431.
|
||||
///
|
||||
/// Type parameters can shadow the core Object type. This was causing a crash
|
||||
/// in DDC compiled code because it was shadowing the native JavaScript Object.
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'dart:core' as core;
|
||||
|
||||
// Applying a mixin with a class cycle causes a crash when trying to walk up the
|
||||
// prototype chain using `Object.getPrototypeOf()`.
|
||||
class A<Object> extends B with C<A> {
|
||||
get extractType => Object;
|
||||
|
||||
// Calling super here caused a crash when trying to walk up the prototype
|
||||
// chain using `Object.getPrototypeOf()`.
|
||||
A() : super();
|
||||
}
|
||||
|
||||
class B {
|
||||
final core.int bar;
|
||||
B() : bar = 0;
|
||||
}
|
||||
|
||||
mixin C<T> {}
|
||||
|
||||
void main() {
|
||||
var a = A();
|
||||
Expect.notEquals(core.Object, a.extractType);
|
||||
|
||||
a = A<core.Object>();
|
||||
Expect.equals(core.Object, a.extractType);
|
||||
}
|
Loading…
Reference in a new issue