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-3860] error: ambiguous use of operator '-' #46445

Open
krzyzanowskim opened this issue Feb 4, 2017 · 3 comments
Open

[SR-3860] error: ambiguous use of operator '-' #46445

krzyzanowskim opened this issue Feb 4, 2017 · 3 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself regression swift 3.0 type checker Area → compiler: Semantic analysis

Comments

@krzyzanowskim
Copy link
Contributor

Previous ID SR-3860
Radar rdar://problem/30393457
Original Reporter @krzyzanowskim
Type Bug

Attachment: Download

Environment

Swift 3.0.2

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

md5: dc1a3e25eed7f5c5f470127841c056e3

Issue Description:

Given sample does not compile. It does compile for the "+" operation, though.

let arr:[UInt32] = [1,2,3]

_ = UInt32(1 - arr[Int(1)]) // error: ambiguous use of operator '-'
_ = UInt32(1 - arr[1])      // ok
Untitled 12.swift:4:14: error: ambiguous use of operator '-'
_ = UInt32(1 - arr[Int(1)]) // error: ambiguous use of operator '-'
             ^
Swift.-:1:13: note: found this candidate
public func -<T : Strideable>(lhs: T, rhs: T) -> T.Stride
            ^
Swift.-:1:13: note: found this candidate
public func -<T : _DisallowMixedSignArithmetic>(lhs: T, rhs: T) -> T._DisallowMixedSignArithmetic
            ^
@jckarter
Copy link
Member

jckarter commented Feb 6, 2017

@swift-ci create

@belkadan
Copy link
Contributor

belkadan commented Feb 7, 2017

Not a regression, at least?

@rintaro
Copy link
Mannequin

rintaro mannequin commented Feb 7, 2017

Looks like 3.0 regression.
This compiles in Swift 2.3.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
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 regression swift 3.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

4 participants