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-8005] Compiler crash with extension that provides all Collection requirements #50538

Closed
natecook1000 opened this issue Jun 15, 2018 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@natecook1000
Copy link
Member

Previous ID SR-8005
Radar rdar://problem/41161317
Original Reporter @natecook1000
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 22ed21fd595abe203b33b302df4fbdb7

duplicates:

  • SR-7499 type recursion not caught in Sema

Issue Description:

This seems related to SR-7729 — trying to compile this code results in a compiler crash: Assertion failed: (found->second && "type recursion not caught in Sema"), function find, file .../swift/lib/SIL/TypeLowering.cpp, line 1413.

public struct DefaultIndex<Base: Sequence> : Comparable {
  // If the next line is commented out, there's no compiler crash
  var element: Base.Element? = nil
  
  init() {}

  public static func ==(lhs: DefaultIndex, rhs: DefaultIndex) -> Bool {
    return true
  }
  public static func < (lhs: DefaultIndex, rhs: DefaultIndex) -> Bool {
    return false
  }
}

extension Collection where Self.Index == DefaultIndex<Self> {
  public var startIndex: Index {
    return DefaultIndex()
  }
  
  public var endIndex: Index {
    return DefaultIndex()
  }
  
  public subscript(i: Index) -> Iterator.Element {
    fatalError()
  }
  
  public func index(after i: Index) -> Index {
    return i
  }
}

// If the following line is commented out, there's no compiler crash
struct ThisIsFine: Collection {}
@belkadan
Copy link
Contributor

@swift-ci create

@dabrahams
Copy link
Collaborator

Probably a dup of, or at least related to, SR-7610 and SR-7605

@rudkx
Copy link
Member

rudkx commented Jun 20, 2018

Nate, do you really mean SR-7729? They don't seem related.

@natecook1000
Copy link
Member Author

…no. Not sure how I ended up linking to that! I think I must have meant SR-7499.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 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. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

5 participants