Skip to content

Commit 8a660e5

Browse files
committed
Revert "Basic Sema support for covariant collection casting."
Ubuntu 14.04 and 15.10 bots failing due to this commit. This reverts commit 4b6a572.
1 parent 65226de commit 8a660e5

File tree

7 files changed

+0
-136
lines changed

7 files changed

+0
-136
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ namespace swift {
143143
/// \brief Enable experimental nested generic types feature.
144144
bool EnableExperimentalNestedGenericTypes = false;
145145

146-
/// \brief Enable generalized collection casting.
147-
bool EnableExperimentalCollectionCasts = false;
148-
149146
/// Should we check the target OSs of serialized modules to see that they're
150147
/// new enough?
151148
bool EnableTargetOSChecking = true;

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@ def enable_experimental_nested_generic_types :
230230
Flag<["-"], "enable-experimental-nested-generic-types">,
231231
HelpText<"Enable experimental support for nested generic types">;
232232

233-
def enable_experimental_collection_casts :
234-
Flag<["-"], "enable-experimental-collection-casts">,
235-
HelpText<"Enable experimental support for general collection casting">;
236-
237233
def disable_availability_checking : Flag<["-"],
238234
"disable-availability-checking">,
239235
HelpText<"Disable checking for potentially unavailable APIs">;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
743743
Opts.EnableExperimentalNestedGenericTypes |=
744744
Args.hasArg(OPT_enable_experimental_nested_generic_types);
745745

746-
Opts.EnableExperimentalCollectionCasts |=
747-
Args.hasArg(OPT_enable_experimental_collection_casts);
748-
749746
Opts.DisableAvailabilityChecking |=
750747
Args.hasArg(OPT_disable_availability_checking);
751748

lib/Sema/CSSimplify.cpp

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3820,15 +3820,6 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
38203820
Type baseType1 = getBaseTypeForArrayType(t1);
38213821
Type baseType2 = getBaseTypeForArrayType(t2);
38223822

3823-
if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
3824-
return matchTypes(baseType1,
3825-
baseType2,
3826-
matchKind,
3827-
subFlags,
3828-
locator.withPathElement(
3829-
ConstraintLocator::PathElement::getGenericArgument(0)));
3830-
}
3831-
38323823
// Look through type variables in the first element type; we need to know
38333824
// it's structure before we can decide whether this can be an array upcast.
38343825
TypeVariableType *baseTypeVar1;
@@ -3882,29 +3873,6 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
38823873
Type key2, value2;
38833874
std::tie(key2, value2) = *isDictionaryType(t2);
38843875

3885-
if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
3886-
// The source key and value types must be subtypes of the destination
3887-
// key and value types, respectively.
3888-
auto result = matchTypes(key1, key2, matchKind, subFlags,
3889-
locator.withPathElement(
3890-
ConstraintLocator::PathElement::getGenericArgument(0)));
3891-
if (result == SolutionKind::Error)
3892-
return result;
3893-
3894-
switch (matchTypes(value1, value2, matchKind, subFlags,
3895-
locator.withPathElement(
3896-
ConstraintLocator::PathElement::getGenericArgument(1)))) {
3897-
case SolutionKind::Solved:
3898-
return result;
3899-
3900-
case SolutionKind::Unsolved:
3901-
return SolutionKind::Unsolved;
3902-
3903-
case SolutionKind::Error:
3904-
return SolutionKind::Error;
3905-
}
3906-
}
3907-
39083876
// Look through type variables in the first key and value type; we
39093877
// need to know their structure before we can decide whether this
39103878
// can be an upcast.
@@ -4011,15 +3979,6 @@ ConstraintSystem::simplifyRestrictedConstraint(ConversionRestrictionKind restric
40113979
auto t2 = type2->getDesugaredType();
40123980
Type baseType2 = getBaseTypeForSetType(t2);
40133981

4014-
if (TC.getLangOpts().EnableExperimentalCollectionCasts) {
4015-
return matchTypes(baseType1,
4016-
baseType2,
4017-
matchKind,
4018-
subFlags,
4019-
locator.withPathElement(
4020-
ConstraintLocator::PathElement::getGenericArgument(0)));
4021-
}
4022-
40233982
// Look through type variables in the first base type; we need to know
40243983
// their structure before we can decide whether this can be an upcast.
40253984
TypeVariableType *baseTypeVar1 = nullptr;

test/SILGen/collection_subtype_downcast.swift

Lines changed: 0 additions & 42 deletions
This file was deleted.

test/SILGen/collection_subtype_upcast.swift

Lines changed: 0 additions & 42 deletions
This file was deleted.

test/expr/cast/array_bridge.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ var aa: [[A]] = []
4848
var bb: [[B]] = []
4949

5050
aa = bb // expected-error {{cannot assign value of type '[[B]]' to type '[[A]]'}}
51-
bb = aa // expected-error {{cannot assign value of type '[[A]]' to type '[[B]]'}}
5251

5352
class C {
5453
}

0 commit comments

Comments
 (0)