From b4a4075d5d2868c3a932004eaed8f22989115948 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 30 May 2024 16:37:47 +0000 Subject: [PATCH] Remove isNonNullableByDefault parameter from isTypeWithoutNullabilityMarker. There is no functional change, because all callers were passing `true`. Change-Id: I59a70e16b543023ee84657cf4e0d7ef3e0d4de8e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367420 Reviewed-by: Chloe Stefantsova Commit-Queue: Paul Berry --- .../fasta/type_inference/type_inference_engine.dart | 2 +- pkg/kernel/lib/src/standard_bounds.dart | 6 ++---- pkg/kernel/lib/type_algebra.dart | 13 +++++-------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart index ecd55eb6a0a..4cbcfc8c3dd 100644 --- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart +++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart @@ -505,7 +505,7 @@ class OperationsCfe @override NullabilitySuffix getNullabilitySuffix(DartType type) { - if (isTypeWithoutNullabilityMarker(type, isNonNullableByDefault: true)) { + if (isTypeWithoutNullabilityMarker(type)) { return NullabilitySuffix.none; } else if (isNullableTypeConstructorApplication(type)) { return NullabilitySuffix.question; diff --git a/pkg/kernel/lib/src/standard_bounds.dart b/pkg/kernel/lib/src/standard_bounds.dart index 791db5e53d4..01a61f977bc 100644 --- a/pkg/kernel/lib/src/standard_bounds.dart +++ b/pkg/kernel/lib/src/standard_bounds.dart @@ -355,10 +355,8 @@ mixin StandardBounds { // DOWN(T1?, T2) = S where S is DOWN(T1, T2) // DOWN(T1, T2?) = S where S is DOWN(T1, T2) { - bool type1HasNullabilityMarker = - !isTypeWithoutNullabilityMarker(type1, isNonNullableByDefault: true); - bool type2HasNullabilityMarker = - !isTypeWithoutNullabilityMarker(type2, isNonNullableByDefault: true); + bool type1HasNullabilityMarker = !isTypeWithoutNullabilityMarker(type1); + bool type2HasNullabilityMarker = !isTypeWithoutNullabilityMarker(type2); if (type1HasNullabilityMarker && !type2HasNullabilityMarker) { return _getNullabilityAwareStandardLowerBound( computeTypeWithoutNullabilityMarker(type1, diff --git a/pkg/kernel/lib/type_algebra.dart b/pkg/kernel/lib/type_algebra.dart index 4566bbbf0ae..e5ee6589799 100644 --- a/pkg/kernel/lib/type_algebra.dart +++ b/pkg/kernel/lib/type_algebra.dart @@ -2152,15 +2152,12 @@ bool isStructuralParameterTypeWithoutNullabilityMarker( isNonNullableByDefault: isNonNullableByDefault); } -bool isTypeWithoutNullabilityMarker(DartType type, - {required bool isNonNullableByDefault}) { - return !type.accept(new _NullabilityMarkerDetector(isNonNullableByDefault)); +bool isTypeWithoutNullabilityMarker(DartType type) { + return !type.accept(const _NullabilityMarkerDetector()); } class _NullabilityMarkerDetector implements DartTypeVisitor { - final bool isNonNullableByDefault; - - const _NullabilityMarkerDetector(this.isNonNullableByDefault); + const _NullabilityMarkerDetector(); @override bool visitAuxiliaryType(AuxiliaryType node) { @@ -2223,13 +2220,13 @@ class _NullabilityMarkerDetector implements DartTypeVisitor { @override bool visitTypeParameterType(TypeParameterType node) { return !isTypeParameterTypeWithoutNullabilityMarker(node, - isNonNullableByDefault: isNonNullableByDefault); + isNonNullableByDefault: true); } @override bool visitStructuralParameterType(StructuralParameterType node) { return !isStructuralParameterTypeWithoutNullabilityMarker(node, - isNonNullableByDefault: isNonNullableByDefault); + isNonNullableByDefault: true); } @override