Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-12759] Heisenbug in Witness Matching Because of Leaked Type Variables #55204

Closed
CodaFi opened this issue May 9, 2020 · 4 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@CodaFi
Copy link
Member

CodaFi commented May 9, 2020

Previous ID SR-12759
Radar rdar://problem/63044867
Original Reporter @CodaFi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee @gregomni
Priority Medium

md5: 77078ce3daf16525ed54cc01919127be

is duplicated by:

  • SR-12789 'τ_0_0' in conformance type-checking diagnostics

Issue Description:

This code exercises the failure about 1 in 10 runs. The problem is that findMissingGenericRequirementForSolutionFix, which was introduced in #19920 escapes type variables to contexts long after their associated constraints systems have gone out of scope. That means any requirements we diagnose involving opened references would have involved a large amount of UB.

// RUN: not %target-swift-frontend %s -emit-silgen

struct CountSteps1<T> : Collection {
  init(count: Int) { self.count = count }
  var count: Int

  var startIndex: Int { 0 }
  var endIndex: Int { count }
  func index(after i: Int) -> Int {
    totalSteps += 1
    return i + 1
  }
  subscript(i: Int) -> Int { return i }
}

extension CountSteps1
  : RandomAccessCollection
     where T : Equatable
{
  typealias Index = Int
  func index(_ i: Index, offsetBy d: Int) -> Index {
    return i + d
  }
}
@CodaFi
Copy link
Member Author

CodaFi commented May 9, 2020

@gregomni Any ideas here?

@CodaFi
Copy link
Member Author

CodaFi commented May 9, 2020

@swift-ci create

@gregomni
Copy link
Collaborator

I'll take a look, thanks!

@gregomni
Copy link
Collaborator

Resolved in #31869

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

2 participants