Skip to content

Commit

Permalink
[cfe] Remove the behaviour for allowing no defaults on unnamed option…
Browse files Browse the repository at this point in the history
…al parameters for wildcards.

Reverting https://dart-review.googlesource.com/c/sdk/+/371560.

Bug: dart-lang/language#3807
Change-Id: I3933d7d6117b90cc0a091c8e3ce1e5bcf8061ec0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377722
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
  • Loading branch information
kallentu authored and Commit Queue committed Jul 29, 2024
1 parent 2f3bca7 commit 76a05ec
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 93 deletions.
8 changes: 0 additions & 8 deletions pkg/front_end/lib/src/source/source_library_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1919,14 +1919,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
if (isOptional &&
formal.variable!.type.isPotentiallyNonNullable &&
!formal.hasDeclaredInitializer) {
// Wildcard optional parameters can't be used so we allow having no
// initializer.
if (libraryFeatures.wildcardVariables.isEnabled &&
formal.isWildcard &&
!formal.isSuperInitializingFormal &&
!formal.isInitializingFormal) {
continue;
}
addProblem(
templateOptionalNonNullableWithoutInitializerError.withArguments(
formal.name, formal.variable!.type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2146,13 +2146,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
if ((isOptionalPositional || isOptionalNamed) &&
formal.type.isPotentiallyNonNullable &&
!formal.hasDeclaredInitializer) {
// Wildcard optional parameters can't be used so we allow having no
// initializer.
if (libraryFeatures.wildcardVariables.isEnabled &&
formal.isWildcard &&
!formal.isInitializingFormal) {
continue;
}
libraryBuilder.addProblem(
templateOptionalNonNullableWithoutInitializerError.withArguments(
formal.name!, formal.type),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 76a05ec

Please sign in to comment.