Ticket #347 (closed defect: fixed)
Cannot make use of optional arguments declared in a library
Reported by: | Charles | Owned by: | Charles |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Cobra Compiler | Version: | 0.9.4 |
Keywords: | Cc: |
Description
The optional argument support in Cobra doesn't work across libraries. In other words, if the method is declared like so:
class X def foo(verbose = false) as int return if(verbose, 1, 0)
Then trying to invoke the method without an argument will work in the same code base, but fail in another project with:
error: The method "foo" is expecting 1 argument, but no arguments are being supplied in this call. The declaration is "foo(verbose as bool)"
This all came up because I tried using optional args in Cobra.Core after which some test cases failed the above error.
The solution will almost certainly be the generation and scanning of attributes on the argument. Ideally, we would use the same conventions as the C# compiler for maximum compatibility between Cobra and C#.