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
A limit for Swift compiler? #50
Comments
Can you give me more information about the error you're seeing? We definitely have a limit on the number of arguments we can write Side note: Unless |
@gfontenot Error
|
Searching for that note ("Type variable id overflow") leads me to this issue in Carthage (which uses both Commandant and Curry): Carthage/Carthage#2831. It looks like it has something to do with the |
@gfontenot Hah, yes, it works. fileprivate static let defaultStringValue: String = ""
public static func evaluate(_ m: CommandMode) -> Result<Self, CommandantError<Swift.Error>> {
return curry(Self.init)
<*> m <| Option(key: "filePath", defaultValue: defaultStringValue, usage: "The path to the file in 'generate' action.")
<*> m <| Switch(flag: "d", key: "debug", usage: "DEBUG")
<*> m <| Option(key: "outputFilePath", defaultValue: defaultStringValue, usage: "Use with flag --filePath. It will output to this file")
<*> m <| Option(key: "transform", defaultValue: "", usage: "Transform with name or shortcut.")
<*> m <| Switch(flag: "l", key: "list", usage: "List available transforms")
<*> m <| Option(key: "templateFilePath", defaultValue: defaultStringValue, usage: "Template file that should be used in some transforms")
<*> m <| Option(key: "commentsHeaderFilePath", defaultValue: defaultStringValue, usage: "Comments header file that will be included at top")
<*> m <| Option(key: "importsFilePath", defaultValue: defaultStringValue, usage: "Import file that will be included at top after comments if presented")
} |
Interesting, that for 7 options it works fine, but for 8 and more it doesn't work without this hack. |
Yeah, very weird. No idea what the compiler is doing. Worth noting that there'a ticket opened against Swift to track the issue. |
@gfontenot Could you add workaround to Readme? |
I'm actually not sure if this is a workaround for Commandant or for Curry. Maybe @ikesyo has thoughts on this? |
I think there are so many type inferences regarding the usages of |
Ah yeah that makes sense too. I didn't know the full type of If this is going to be called out somewhere, I do think it should probably be in Commandant, since it's not actually specific to Curry, but is instead an issue when using Commandant with Curry. I'm going to go ahead and close this issue for now, but please let me know if I can help further. |
I am using currying for options in Commandant library.
Following code will not compile and aborted with type inference error.
UPD:
Error while compiling ( with Internal error in Source code editor when it prays to file a bug. )
The text was updated successfully, but these errors were encountered: