Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/Sema/ConstraintSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,17 +1700,17 @@ Type simplifyTypeImpl(ConstraintSystem &cs, Type type, Fn getFixedTypeFn) {
lookupBaseType = objectType;
}

if (!lookupBaseType->mayHaveMembers()) return type;

auto subs = lookupBaseType->getContextSubstitutionMap(
if (lookupBaseType->mayHaveMembers()) {
auto subs = lookupBaseType->getContextSubstitutionMap(
cs.DC->getParentModule(),
assocType->getDeclContext());
auto result = assocType->getDeclaredInterfaceType().subst(subs);
assocType->getDeclContext());
auto result = assocType->getDeclaredInterfaceType().subst(subs);

if (result)
return result;
if (result)
return result;
}

return DependentMemberType::get(ErrorType::get(newBase), assocType);
return DependentMemberType::get(lookupBaseType, assocType);
}

return type;
Expand Down
6 changes: 6 additions & 0 deletions lib/Sema/TypeCheckPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,12 @@ bool TypeChecker::typeCheckPattern(Pattern *P, DeclContext *dc,
case PatternKind::Typed: {
TypedPattern *TP = cast<TypedPattern>(P);
bool hadError = validateTypedPattern(*this, dc, TP, options, &resolver);

// If we have unbound generic types, don't apply them below; instead,
// the caller will call typeCheckBinding() later.
if (P->getType()->hasUnboundGenericType())
return hadError;

Pattern *subPattern = TP->getSubPattern();
if (coercePatternToType(subPattern, dc, P->getType(),
options|TR_FromNonInferredPattern, &resolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

// REQUIRES: asserts
// RUN: not --crash %target-swift-frontend %s -emit-ir
// RUN: not %target-swift-frontend %s -emit-ir
guard let f==A:UnfoldSequence