Navigation Menu

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-10429] Compiler crash with conditional conformance to Expressible* protocol #52829

Closed
NevinBR opened this issue Apr 9, 2019 · 5 comments
Closed
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 diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression regression swift 5.0 type checker Area → compiler: Semantic analysis

Comments

@NevinBR
Copy link
Contributor

NevinBR commented Apr 9, 2019

Previous ID SR-10429
Radar rdar://problem/50170241
Original Reporter @NevinBR
Type Bug
Status Resolved
Resolution Duplicate
Environment

Swift 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)

Xcode 10.2 (10E125)

macOS 10.14.4 (18E226)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 8daab1e7ba0426b1245a9136c9f9ce12

duplicates:

  • SR-10271 Compiler crash during compilation

relates to:

  • SR-10271 Compiler crash during compilation

Issue Description:

The following code crashes the compiler and gives a “Failed to produce diagnostic” error:

extension Array: ExpressibleByIntegerLiteral where Element: ExpressibleByIntegerLiteral {
  public init(integerLiteral value: Element.IntegerLiteralType) {
    self = [Element(integerLiteral: value)]
  }
}

let x = 0 as Array  // SourceKitService quit unexpectedly
print(x)            // Failed to produce diagnostic for expression; please file a bug report

For comparison:

let y = 1 as Array<Int>   // Works
let z: Array = 2          // Cannot convert value of type 'Int' to specified type 'Array'
let w: Array<Int> = 3     // Works
@belkadan
Copy link
Contributor

belkadan commented Apr 9, 2019

+Asserts isn't much more useful:

checked decl cannot have error type
(var_decl range=[<stdin>:7:5 - line:7:5] "x" type='<<error type>>' interface type='<<error type>>' access=internal let readImpl=stored immutable)
Stack dump:
0.  Program arguments: /Volumes/Data/swift-public/build/ninja/swift-macosx-x86_64/bin/swift -frontend -c -primary-file - -target x86_64-apple-darwin19.0.0 -enable-objc-interop -sdk /Volumes/Data/Applications/Yellowstone.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main -o /var/folders/qy/2z8q344s57lg875tnwpdlw2c0000gn/T/--4eea31.o 
1.  While walking into decl declaration 0x7fe7180c1d40 (at <stdin>:7:1)
2.  While verifying VarDecl 'x' (at <stdin>:7:5)

@NevinBR
Copy link
Contributor Author

NevinBR commented Apr 9, 2019

Perhaps relevant, it works without error using concrete types like this:

{code:swift}
extension Array: ExpressibleByIntegerLiteral where Element == Int {
public init(integerLiteral value: Int) {
self = [value]
}
}

@theblixguy
Copy link
Collaborator

Looks like SR-10271

@belkadan
Copy link
Contributor

Ah, thanks, very likely.

@xedin
Copy link
Member

xedin commented May 4, 2019

This is the same as SR-10271, the problem here is that when solver fails to infer any type for one of the generic parameters CSDiag is not properly set up to figure out what is going on…

@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
@AnthonyLatsis AnthonyLatsis added failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression type checker Area → compiler: Semantic analysis regression swift 5.0 diagnostics QoI Bug: Diagnostics Quality of Implementation labels Dec 22, 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 diagnostics QoI Bug: Diagnostics Quality of Implementation failed to produce diagnostic Bug → internal error: Failed to produce diagnostic for expression regression swift 5.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

5 participants