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-13873] Swift segfaults instead of yielding type eror #56271

Closed
swift-ci opened this issue Nov 18, 2020 · 2 comments
Closed

[SR-13873] Swift segfaults instead of yielding type eror #56271

swift-ci opened this issue Nov 18, 2020 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-13873
Radar None
Original Reporter Stiivi (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)

Target: x86_64-apple-darwin20.1.0

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

md5: 0d7339ab6cc1a90a4e92433fdd62cf0a

Issue Description:

The following errorneous code is offending:

var text: String = ""
var currentChar: Character?
// ...
text += currentChar!

Expected: It should yield a type error for the incompatible += operator argument currentChar.

@typesanitizer
Copy link

Looks like this has been fixed on the main branch, can you verify with a recent toolchain snapshot from https://swift.org/download/#snapshots?

@swift-ci
Copy link
Collaborator Author

Comment by Stefan Urbanek (JIRA)

Thanks, seems to work as expected:

bork.swift:4:6: error: binary operator '+=' cannot be applied to operands of type 'String' and 'Character'
text += currentChar!
~~~~ ^ ~~~~~~~~~~~~
bork.swift:4:6: note: overloads for '+=' exist with these partially matching parameter lists: (inout String, String)
text += currentChar!
{{ ^}}

@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