@@ -1130,14 +1130,6 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
1130
1130
1131
1131
auto id = comp->getIdentifier ();
1132
1132
1133
- // If we're compiling for Swift version < 5 and we have a mention of
1134
- // ImplicitlyUnwrappedOptional where it is not allowed, treat it as
1135
- // if it was spelled Optional.
1136
- if (id == TC.Context .Id_ImplicitlyUnwrappedOptional
1137
- && !options.contains (TypeResolutionFlags::AllowIUO)
1138
- && !TC.Context .isSwiftVersionAtLeast (5 ))
1139
- id = TC.Context .Id_Optional ;
1140
-
1141
1133
NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
1142
1134
if (options.contains (TypeResolutionFlags::KnownNonCascadingDependency))
1143
1135
lookupOptions |= NameLookupFlags::KnownPrivate;
@@ -1239,7 +1231,7 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
1239
1231
}
1240
1232
} else if (isa<GenericIdentTypeRepr>(comp)) {
1241
1233
Diagnostic diag =
1242
- diag::implicitly_unwrapped_optional_spelling_decay_to_optional ;
1234
+ diag::implicitly_unwrapped_optional_spelling_suggest_optional ;
1243
1235
1244
1236
if (TC.Context .isSwiftVersionAtLeast (5 ))
1245
1237
diag = diag::implicitly_unwrapped_optional_spelling_in_illegal_position;
@@ -1258,7 +1250,7 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
1258
1250
genericTyR->getAngleBrackets ().End .getAdvancedLoc (1 ));
1259
1251
} else {
1260
1252
Diagnostic diag =
1261
- diag::implicitly_unwrapped_optional_spelling_decay_to_optional ;
1253
+ diag::implicitly_unwrapped_optional_spelling_suggest_optional ;
1262
1254
1263
1255
if (TC.Context .isSwiftVersionAtLeast (5 ))
1264
1256
diag = diag::
@@ -2847,7 +2839,7 @@ Type TypeResolver::resolveImplicitlyUnwrappedOptionalType(
2847
2839
TypeResolutionOptions options) {
2848
2840
if (!options.contains (TypeResolutionFlags::AllowIUO)) {
2849
2841
Diagnostic diag = diag::
2850
- implicitly_unwrapped_optional_in_illegal_position_decay_to_optional ;
2842
+ implicitly_unwrapped_optional_in_illegal_position_suggest_optional ;
2851
2843
2852
2844
if (TC.Context .isSwiftVersionAtLeast (5 ))
2853
2845
diag = diag::implicitly_unwrapped_optional_in_illegal_position;
@@ -2865,12 +2857,8 @@ Type TypeResolver::resolveImplicitlyUnwrappedOptionalType(
2865
2857
if (!baseTy || baseTy->hasError ()) return baseTy;
2866
2858
2867
2859
Type uncheckedOptionalTy;
2868
- if (!options.contains (TypeResolutionFlags::AllowIUO))
2869
- // Treat IUOs in illegal positions as optionals.
2870
- uncheckedOptionalTy = TC.getOptionalType (repr->getExclamationLoc (), baseTy);
2871
- else
2872
- uncheckedOptionalTy = TC.getImplicitlyUnwrappedOptionalType (
2873
- repr->getExclamationLoc (), baseTy);
2860
+ uncheckedOptionalTy =
2861
+ TC.getImplicitlyUnwrappedOptionalType (repr->getExclamationLoc (), baseTy);
2874
2862
2875
2863
if (!uncheckedOptionalTy)
2876
2864
return ErrorType::get (Context);
0 commit comments