27d2904b0a
This fixes #60059 when `--minify` is not used. With minification we expect that runtime and const symbols won't be equal or identical, even when the symbol names are the same. Issue: https://github.com/dart-lang/sdk/issues/60059 Change-Id: Id6560558e2bd00cd9bef1f0026e2bd92a74d82fc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414783 Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com>
26 lines
858 B
Dart
26 lines
858 B
Dart
// Copyright (c) 2025, 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.
|
|
|
|
// dart2wasmOptions=--extra-compiler-option=--minify
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
void f({int a = 0}) {
|
|
Expect.equals(123, a);
|
|
}
|
|
|
|
bool get runtimeTrue => int.parse('1') == 1;
|
|
|
|
void main() {
|
|
// With minification, non-const symbols won't be identical or equal to the
|
|
// const symbols, so `Symbol('a')` here won't match `a` in the `f`'s named
|
|
// parameters and `Function.apply` will throw an error.
|
|
Expect.throws<NoSuchMethodError>(
|
|
() => Function.apply((runtimeTrue ? f : (() {})), [], {Symbol('a'): 123}),
|
|
);
|
|
|
|
// `const` symbols will work as before.
|
|
Function.apply((runtimeTrue ? f : (() {})), [], {#a: 123});
|
|
}
|