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-10320] Swift Compiler Doesn't Respect Function Argument Limits #52720

Open
swift-ci opened this issue Apr 5, 2019 · 0 comments
Open

[SR-10320] Swift Compiler Doesn't Respect Function Argument Limits #52720

swift-ci opened this issue Apr 5, 2019 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself parser Area → compiler: The legacy C++ parser

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 5, 2019

Previous ID SR-10320
Radar None
Original Reporter plinth666 (JIRA User)
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, Parser
Assignee None
Priority Medium

md5: db223fce161d3f1610d14346ddaa647a

Issue Description:

Enter the following program:

import Foundation

print ("import Foundation")

print ("type alias bigFunc = (")

for i in 0 ..< 65537 {

if i == 65537 - 1 {

    print ("UInt8) -\> ()")

} else {

    print ("UInt8, ", terminator: "")

}

if (i % 32 == 0 && i != 0) {

    print()

}

}

print ("let t = bigFunc.self")

print ("print (t)")

Collect the output and use it as input to the swift compiler (LimitCheck | pbcopy).

The compiler will compile this (good on you!), but the output is:

(Int8)->()

Instead of the expected 65536 parameters.

This is because the function type metadata in swift has a limit of 65535 parameters.

The compiler should flag this as an error.

I'm fairly certain you will get a similar error if you use a tuple type instead of a function type.

@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 parser Area → compiler: The legacy C++ parser
Projects
None yet
Development

No branches or pull requests

1 participant