Skip to content

Commit f568598

Browse files
author
Dart CI
committed
Version 2.16.0-98.0.dev
Merge commit '1c1f518bff015e6518b86fc3196b8796d45c3d08' into 'dev'
2 parents 89ded53 + 1c1f518 commit f568598

File tree

7 files changed

+614
-126
lines changed

7 files changed

+614
-126
lines changed

pkg/vm/lib/transformations/type_flow/transformer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class MoveFieldInitializers {
160160
if (!_isRedirectingConstructor(c)) c
161161
];
162162

163-
assert(constructors.isNotEmpty);
163+
assert(constructors.isNotEmpty || cls.isMixinDeclaration);
164164

165165
// Move field initializers to constructors.
166166
// Clone AST for all constructors except the first.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) 2021, 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+
// Regression test for dartbug.com/47822
6+
7+
mixin M {
8+
int x = (() => 7)();
9+
}
10+
11+
class C with M {}
12+
13+
main() {
14+
print(C().x);
15+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
library #lib /*isNonNullableByDefault*/;
2+
import self as self;
3+
import "dart:core" as core;
4+
5+
abstract class M extends core::Object /*isMixinDeclaration*/ {
6+
}
7+
abstract class _C&Object&M extends core::Object implements self::M /*isAnonymousMixin,isEliminatedMixin*/ {
8+
[@vm.inferred-type.metadata=int?] [@vm.procedure-attributes.metadata=methodOrSetterCalledDynamically:false,getterCalledDynamically:false,hasThisUses:false,hasNonThisUses:false,hasTearOffUses:false,methodOrSetterSelectorId:1,getterSelectorId:2] field core::int x;
9+
synthetic constructor •() → self::_C&Object&M
10+
: self::_C&Object&M::x = (() → core::int => 7)(){() → core::int}, super core::Object::•()
11+
;
12+
}
13+
class C extends self::_C&Object&M {
14+
synthetic constructor •() → self::C
15+
: super self::_C&Object&M::•()
16+
;
17+
}
18+
static method main() → dynamic {
19+
core::print([@vm.direct-call.metadata=#lib::_C&Object&M.x] [@vm.inferred-type.metadata=int?] new self::C::•().{self::_C&Object&M::x}{core::int});
20+
}

0 commit comments

Comments
 (0)