Skip to content

Commit e2cbe29

Browse files
authored
Add a rule to say that a mixin class cannot declare a non-trival constructor (#4674)
1 parent 9d00e02 commit e2cbe29

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

accepted/future-releases/primary-constructors/feature-specification.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Author: Erik Ernst
44

55
Status: Accepted
66

7-
Version: 1.15
7+
Version: 1.16
88

99
Experiment flag: primary-constructors
1010

@@ -674,6 +674,11 @@ A compile-time error occurs if a class, mixin class, enum, or extension type has
674674
a primary constructor which has a body part that includes any of the modifiers
675675
`async`, `async*`, or `sync*`, or if it uses `=>` rather than a block.
676676

677+
A compile-time error occurs if a mixin class declaration has a primary
678+
constructor which is not trivial, that is, it declares one or more
679+
parameters, or it has a body part that has an initializer list or
680+
a body.
681+
677682
The definition of a _potentially constant_ expression is extended with a new
678683
case: An identifier expression denoting a parameter of a constant primary
679684
constructor that occurs in the initializer list of the body part of the primary
@@ -986,6 +991,11 @@ of declaration, and the constructor might be non-const).
986991

987992
### Changelog
988993

994+
1.16 - March 31, 2026
995+
996+
* Add rules to specify compile-time errors for primary constructors
997+
corresponding to the errors that apply to other constructors.
998+
989999
1.15 - March 11, 2026
9901000

9911001
* Generalize potentially constant expressions. Specify compile-time errors

0 commit comments

Comments
 (0)