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-11394] CSDiagnostics.cpp:3946: virtual bool swift::constraints::MissingContextualConformanceFailure::diagnoseAsError(): Assertion `isa<AssignExpr>(anchor)' failed. #53795

Closed
ankitspd opened this issue Aug 29, 2019 · 3 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@ankitspd
Copy link
Member

Previous ID SR-11394
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Done
Environment

Swift version 5.1-dev (LLVM c5340df2d1, Swift faaa3a8)
Target: x86_64-unknown-linux-gnu

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @theblixguy
Priority Medium

md5: 50d8fe374622bd30a0ac2ef5b4336490

Issue Description:

This crashes on Linux but not on macOS:

import Foundation

@inlinable public func os_log(
    _ message: StaticString,
    _ args: CVarArg...
) {}

let b = false
os_log("Hello %d", b ? "b" : "e")
swift: /home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-16_04/swift/lib/Sema/CSDiagnostics.cpp:3946: virtual bool swift::constraints::MissingContextualConformanceFailure::diagnoseAsError(): Assertion `isa<AssignExpr>(anchor)' failed.
Stack dump:
0.  Program arguments: /toolchain/usr/bin/swift -frontend -interpret main.swift -disable-objc-interop -color-diagnostics -module-name main
1.  Swift version 5.1-dev (LLVM c5340df2d1, Swift faaa3a859d)
2.  While type-checking statement at [main.swift:10:1 - line:10:33] RangeText="os_log("Hello %d", b ? "b" : "e""
3.  While type-checking expression at [main.swift:10:1 - line:10:33] RangeText="os_log("Hello %d", b ? "b" : "e""
/toolchain/usr/bin/swift[0x49b8814]
/toolchain/usr/bin/swift[0x49b6430]
/toolchain/usr/bin/swift[0x49b8c38]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7f05b34d3390]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38)[0x7f05b1c12428]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a)[0x7f05b1c1402a]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dbd7)[0x7f05b1c0abd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7f05b1c0ac82]
/toolchain/usr/bin/swift[0xf267ad]
/toolchain/usr/bin/swift[0xf11a81]
/toolchain/usr/bin/swift[0xf0c5c2]
/toolchain/usr/bin/swift[0x1088593]
/toolchain/usr/bin/swift[0x1087c0d]
/toolchain/usr/bin/swift[0x14185e3]
/toolchain/usr/bin/swift[0x1417100]
/toolchain/usr/bin/swift[0x141941a]
/toolchain/usr/bin/swift[0x1414d7b]
/toolchain/usr/bin/swift[0x1084767]
/toolchain/usr/bin/swift[0x1084919]
/toolchain/usr/bin/swift[0xfab204]
/toolchain/usr/bin/swift[0xfaae48]
/toolchain/usr/bin/swift[0x1053d2b]
/toolchain/usr/bin/swift[0x1050c26]
/toolchain/usr/bin/swift[0x1050d36]
/toolchain/usr/bin/swift[0x107d5cb]
/toolchain/usr/bin/swift[0x79c46c]
/toolchain/usr/bin/swift[0x79b32f]
/toolchain/usr/bin/swift[0x79aa7d]
/toolchain/usr/bin/swift[0x50a295]
/toolchain/usr/bin/swift[0x508ccf]
/toolchain/usr/bin/swift[0x4a0aed]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f05b1bfd830]
/toolchain/usr/bin/swift[0x4a0649]
Aborted
@theblixguy
Copy link
Collaborator

Here's a much smaller reproducer:

protocol Foo {} 
func foo(_ bar: Foo) {}
foo(true ? "a" : "b")

It does crash for me on macOS as well.

@theblixguy
Copy link
Collaborator

Fix: #26944

@theblixguy
Copy link
Collaborator

Fixed on master - please verify using the next master snapshot and close the issue. Thank you.

@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. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants