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-1914] Array '+' fails to type check #44523

Closed
gribozavr opened this issue Jun 27, 2016 · 4 comments
Closed

[SR-1914] Array '+' fails to type check #44523

gribozavr opened this issue Jun 27, 2016 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself type checker Area → compiler: Semantic analysis

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-1914
Radar None
Original Reporter @gribozavr
Type Bug
Status Closed
Resolution Cannot Reproduce
Environment

Xcode Version 9.2 (9C40b)

Swift 4.0.3

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

md5: a9a12061c71c15fd20185f313dd82c65

Issue Description:

I think this code should type check:

func quickSort(_ array: [Int]) -> [Int] {
  let pivot = 0
  return quickSort(array) + [pivot] + quickSort(array) // error: 'Int' is not convertible to '[Int]'
}
@swift-ci
Copy link
Collaborator

Comment by Paul Taykalo (JIRA)

It can also be simplified to something like

let i:Int = 2
let s:[Int] = [i] + [i] + [i] // Error: 'Int' is not convertible to '[Int]'

@swift-ci
Copy link
Collaborator

Comment by Junkai Wu (JIRA)

Still a bug in Swift 4

@swift-ci
Copy link
Collaborator

Comment by Junkai Wu (JIRA)

Seems it's solved in Swift 4.1. Nice!

@mdiep
Copy link
Contributor

mdiep commented Jun 15, 2018

Fixed in Swift 4.1, as noted above.

@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 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants