-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dart: fix problems with default values that use collection types (#1622)
This series fixes problems that occur when either @immutable or @PositionalDefaults annotation is used in combination with collection types. -------- @PositionalDefaults -------- The usage of 'PositionalDefaults' annotation combined with nullable collection field that has 'null' default value yields the code that does not compile. The generator blindly applies 'const' keyword before the default value for collections. A special 'null' value is not taken into account. -------- @immutable -------- Usage of 'Immutable' annotation combined with collection fields that have default values yields the code that does not compile. The generator does not apply 'const' keyword before the calls to constructors of collections. It is required, because the constructor of 'Immutable' structure is marked as 'const'. The same happens when an explicit field constructor is used. Because of 'Immutable' usage it is marked as a const, but the default values are not initialized with values prepended by 'const'. -------- Content of change -------- - New smoke and functional tests that were used to confirm the invalid behavior. - Adjustments of 'DartStructConstructors.mustache' file to correctly prepend 'const' keyword when needed and to treat 'null' as it should be treated. Signed-off-by: Patryk Wrobel <[email protected]>
- Loading branch information
1 parent
33567ae
commit b516e6b
Showing
11 changed files
with
1,112 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.