Files
sdk/tests/language_2/mixin/super_with_initializer_test.dart
T
Sigmund Cherem b461400e5a [tests] Add regression test for mixin+super+initializer.
This change adds a test to ensure we properly handle super calls in mixin that
override initializers.

This is a regression test for https://github.com/dart-lang/sdk/issues/44636,
which happened to trigger a stack-overflow in ddc.  The issue existed for a long
time, but was fixed in a recent CFE change
https://github.com/dart-lang/sdk/commit/52db62dd65284192755906691baf66c47a43f47e

Change-Id: I7d4aceb8e313f0000e32d9550f301792a9ab84cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178900
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-01-12 22:48:44 +00:00

33 lines
761 B
Dart

// Copyright (c) 2021, 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.
// @dart = 2.9
/// Regression test for mixin overrides (dartbug.com/44636).
///
/// Prior to the fix, B's initializer was accidentally being applied on the
/// overriden definition in C, and as a result, the program would stack
/// overflow.
import 'package:expect/expect.dart';
class A = B with C;
mixin M {}
abstract class B with M {
Object _test = "a";
}
mixin C on B, M {
@override
Object get _test => super._test;
@override
set _test(Object value) {
super._test = value;
}
}
main() => Expect.equals("a", A()._test);