Skip to content

Commit c98df5b

Browse files
eernstgcommit-bot@chromium.org
authored andcommitted
Check that type alias equality relies on the underlying type, not the typedefed name.
Note that this is a multi-test, which is helpful in order to make it visible which situations are covered and which ones are not, but when it all works it would make sense to just run everything in one step, in order to get better performance. Change-Id: Ifab94f7ad369a7c76bab3337eabf2ddd22821b04 Reviewed-on: https://dart-review.googlesource.com/47882 Commit-Queue: Erik Ernst <[email protected]> Reviewed-by: Lasse R.H. Nielsen <[email protected]>
1 parent 155e55c commit c98df5b

5 files changed

+49
-1
lines changed

tests/language_2/language_2_dart2js.status

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,10 @@ partial_tearoff_instantiation_test/06: Pass # for the wrong reason.
10411041
partial_tearoff_instantiation_test/07: Pass # for the wrong reason.
10421042
partial_tearoff_instantiation_test/08: Pass # for the wrong reason.
10431043
partial_tearoff_instantiation_test/none: CompileTimeError
1044+
type_alias_equality_test/01: RuntimeError # Issue 31359
1045+
type_alias_equality_test/02: RuntimeError # Issue 31359
1046+
type_alias_equality_test/03: RuntimeError # Issue 31359
1047+
type_alias_equality_test/04: RuntimeError # Issue 31359
10441048

10451049
[ $compiler == dart2js && $fasta && $host_checked && $strong ]
10461050
abstract_factory_constructor_test/00: MissingCompileTimeError

tests/language_2/language_2_dartdevc.status

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ syntax_test/none: CompileTimeError
181181
truncdiv_test: RuntimeError # Issue 29920
182182
try_catch_on_syntax_test/10: MissingCompileTimeError
183183
try_catch_on_syntax_test/11: MissingCompileTimeError
184+
type_alias_equality_test/01: RuntimeError # Issue 31359
185+
type_alias_equality_test/02: RuntimeError # Issue 31359
186+
type_alias_equality_test/03: RuntimeError # Issue 31359
187+
type_alias_equality_test/04: RuntimeError # Issue 31359
184188
type_inference_circularity_test: MissingCompileTimeError
185189
type_inference_inconsistent_inheritance_test: MissingCompileTimeError
186190
type_promotion_functions_test/02: CompileTimeError # Issue 30895
@@ -650,6 +654,7 @@ syntax_test/32: MissingCompileTimeError
650654
syntax_test/33: MissingCompileTimeError
651655
tearoff_dynamic_test: RuntimeError # Issue 32194
652656
try_catch_test/01: MissingCompileTimeError
657+
type_alias_equality_test/02: RuntimeError # Issue 31359
653658
type_literal_test: RuntimeError # Expect.equals(expected: <Func>, actual: <(bool) => int>) fails.
654659
type_promotion_functions_test/02: CompileTimeError # Issue 31537
655660
type_promotion_functions_test/03: CompileTimeError # Issue 31537

tests/language_2/language_2_kernel.status

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,11 @@ vm/type_vm_test/34: MissingRuntimeError
538538
vm/type_vm_test/35: MissingRuntimeError
539539
vm/type_vm_test/36: MissingRuntimeError
540540

541+
[ $compiler == dartk && $runtime == vm ]
542+
type_alias_equality_test/02: RuntimeError # Issue 31359
543+
type_alias_equality_test/03: RuntimeError # Issue 31359
544+
type_alias_equality_test/04: RuntimeError # Issue 31359
545+
541546
[ $compiler == dartk && $runtime == vm && $checked && $strong ]
542547
assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation.
543548
assert_initializer_test/32: MissingCompileTimeError # KernelVM bug: Constant evaluation.
@@ -696,8 +701,8 @@ mock_writable_final_private_field_test: RuntimeError # Issue 30849
696701
named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
697702
named_parameters_default_eq_test/none: RuntimeError
698703
nested_generic_closure_test: RuntimeError
699-
no_main_test/01: Skip
700704
no_main_test/01: DartkCrash
705+
no_main_test/01: Skip
701706
no_such_method_mock_test: RuntimeError # Issue 31426
702707
null_no_such_method_test: CompileTimeError # Issue 31533
703708
override_inheritance_field_test/04: CompileTimeError # Issue 31616
@@ -802,6 +807,11 @@ vm/type_vm_test/34: MissingRuntimeError
802807
vm/type_vm_test/35: MissingRuntimeError
803808
vm/type_vm_test/36: MissingRuntimeError
804809

810+
[ $compiler == dartkp && $runtime == dart_precompiled ]
811+
type_alias_equality_test/02: RuntimeError # Issue 31359
812+
type_alias_equality_test/03: RuntimeError # Issue 31359
813+
type_alias_equality_test/04: RuntimeError # Issue 31359
814+
805815
[ $compiler == dartkp && $runtime == dart_precompiled && $checked && $strong ]
806816
assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation.
807817
assert_initializer_test/32: MissingCompileTimeError # KernelVM bug: Constant evaluation.
@@ -2174,3 +2184,4 @@ unresolved_top_level_var_test: MissingCompileTimeError
21742184
[ $compiler == dartk || $compiler == dartkp ]
21752185
generic_function_bounds_test: RuntimeError # Issue 32076
21762186
generic_test/01: MissingCompileTimeError
2187+

tests/language_2/language_2_vm.status

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,6 +1340,10 @@ nosuchmethod_forwarding/nosuchmethod_forwarding_test/06: RuntimeError
13401340
nosuchmethod_forwarding/nosuchmethod_forwarding_arguments_test: RuntimeError
13411341
nsm5_test: MissingCompileTimeError
13421342
override_inheritance_no_such_method_test/05: MissingCompileTimeError
1343+
type_alias_equality_test/01: RuntimeError # Issue 31359
1344+
type_alias_equality_test/02: RuntimeError # Issue 31359
1345+
type_alias_equality_test/03: RuntimeError # Issue 31359
1346+
type_alias_equality_test/04: RuntimeError # Issue 31359
13431347

13441348
[ $compiler == none && $runtime == vm && !$checked ]
13451349
assertion_initializer_const_error_test/01: MissingCompileTimeError
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2018, 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+
// Test that type aliases perform equality tests according to the
6+
// underlying function type, not as if they were a distinct type
7+
// for each type alias declaration.
8+
9+
import 'package:expect/expect.dart';
10+
11+
typedef F1 = void Function(int);
12+
typedef F2 = void Function(int);
13+
typedef void F3(int);
14+
15+
typedef G1 = X Function<X>(X);
16+
typedef G2 = X Function<X>(X);
17+
typedef G3 = Y Function<Y>(Y);
18+
19+
main() {
20+
Expect.equals(F1, F2); //# 01: ok
21+
Expect.equals(F1, F3); //# 02: ok
22+
Expect.equals(G1, G2); //# 03: ok
23+
Expect.equals(G1, G3); //# 04: ok
24+
}

0 commit comments

Comments
 (0)