mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sema: Fix crash in type resolution when tuple type contains type variables
This can happen when we're generating constraints and resolving the type annotations written in a closure expression. Just skip the non-copyable check in this case. Fixes rdar://problem/143031466.
This commit is contained in:
@@ -5676,6 +5676,7 @@ NeverNullType TypeResolver::resolveTupleType(TupleTypeRepr *repr,
|
||||
inStage(TypeResolutionStage::Interface) &&
|
||||
!moveOnlyElementIndex.has_value() &&
|
||||
!ty->hasUnboundGenericType() &&
|
||||
!ty->hasTypeVariable() &&
|
||||
!isa<TupleTypeRepr>(tyR)) {
|
||||
auto contextTy = GenericEnvironment::mapTypeIntoContext(
|
||||
resolution.getGenericSignature().getGenericEnvironment(), ty);
|
||||
|
||||
5
test/Constraints/issue-77315.swift
Normal file
5
test/Constraints/issue-77315.swift
Normal file
@@ -0,0 +1,5 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
func foo<T>(_: () -> (Optional<T>, Int)) -> T { fatalError() }
|
||||
|
||||
let x: Int = foo { () -> (Optional, Int) in fatalError() }
|
||||
Reference in New Issue
Block a user