@@ -1130,14 +1130,6 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
11301130
11311131 auto id = comp->getIdentifier ();
11321132
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-
11411133 NameLookupOptions lookupOptions = defaultUnqualifiedLookupOptions;
11421134 if (options.contains (TypeResolutionFlags::KnownNonCascadingDependency))
11431135 lookupOptions |= NameLookupFlags::KnownPrivate;
@@ -1239,7 +1231,7 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
12391231 }
12401232 } else if (isa<GenericIdentTypeRepr>(comp)) {
12411233 Diagnostic diag =
1242- diag::implicitly_unwrapped_optional_spelling_decay_to_optional ;
1234+ diag::implicitly_unwrapped_optional_spelling_suggest_optional ;
12431235
12441236 if (TC.Context .isSwiftVersionAtLeast (5 ))
12451237 diag = diag::implicitly_unwrapped_optional_spelling_in_illegal_position;
@@ -1258,7 +1250,7 @@ resolveTopLevelIdentTypeComponent(TypeChecker &TC, DeclContext *DC,
12581250 genericTyR->getAngleBrackets ().End .getAdvancedLoc (1 ));
12591251 } else {
12601252 Diagnostic diag =
1261- diag::implicitly_unwrapped_optional_spelling_decay_to_optional ;
1253+ diag::implicitly_unwrapped_optional_spelling_suggest_optional ;
12621254
12631255 if (TC.Context .isSwiftVersionAtLeast (5 ))
12641256 diag = diag::
@@ -2847,7 +2839,7 @@ Type TypeResolver::resolveImplicitlyUnwrappedOptionalType(
28472839 TypeResolutionOptions options) {
28482840 if (!options.contains (TypeResolutionFlags::AllowIUO)) {
28492841 Diagnostic diag = diag::
2850- implicitly_unwrapped_optional_in_illegal_position_decay_to_optional ;
2842+ implicitly_unwrapped_optional_in_illegal_position_suggest_optional ;
28512843
28522844 if (TC.Context .isSwiftVersionAtLeast (5 ))
28532845 diag = diag::implicitly_unwrapped_optional_in_illegal_position;
@@ -2865,12 +2857,8 @@ Type TypeResolver::resolveImplicitlyUnwrappedOptionalType(
28652857 if (!baseTy || baseTy->hasError ()) return baseTy;
28662858
28672859 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);
28742862
28752863 if (!uncheckedOptionalTy)
28762864 return ErrorType::get (Context);
0 commit comments