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-6602] 0.magnitude fails to compile #49152

Closed
stephentyrone opened this issue Dec 13, 2017 · 4 comments
Closed

[SR-6602] 0.magnitude fails to compile #49152

stephentyrone opened this issue Dec 13, 2017 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@stephentyrone
Copy link
Member

Previous ID SR-6602
Radar None
Original Reporter @stephentyrone
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 71da5cb24fb0749e1bcec1cf4ee5fbec

is duplicated by:

  • SR-6606 crash on .magnitude applied to literal 0

Issue Description:

It's not immediately obvious to me what's going on here:

1> 0.magnitude

error: repl.swift:1:3: error: arithmetic operation '18446744073709551615 + 1' (on unsigned 64-bit integer type) results in an overflow

0.magnitude

^

Doesn't reproduce with Int(0) or UInt(0).

@belkadan
Copy link
Contributor

That's a compiler diagnostic, not a run-time diagnostic, hence why Int(0) gets past it. Given that no one would write this it doesn't seem urgent to fix, but it's still interesting.

@eeckstein, who owns overflow diagnostics these days?

@xwu
Copy link
Collaborator

xwu commented Dec 25, 2017

Interesting that Int(0) gets past it, because Int().magnitude fails too. I just stumbled on this when writing a test.

@dcci
Copy link
Mannequin

dcci mannequin commented Jul 25, 2019

This works now, Steve. Can you please try?

local@locals-iMac-Pro-3 bin % ../../lldb-macosx-x86_64/bin/lldb --repl
Welcome to Swift version 5.1-dev (LLVM 200186e28b, Swift a8dc4be076).
Type :help for assistance.
  1> 0.magnitude
$R0: UInt = 0

@stephentyrone
Copy link
Member Author

Yup. Sadly I don't know exactly what we did to fix it =/

@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

3 participants