-
Notifications
You must be signed in to change notification settings - Fork 33
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
ERROR new is not provided with the correct number of arguments #38
Comments
Yes, I missed that. How about this?
|
Also, if you do something like this: type MyType
a::Int
b::Int
function MyType( x )
@lintpragma( "Ignore short new argument" )
new(x)
end
end It would suppress warnings as well. |
I was thinking something along the lines of nargs=0 -> no warning. |
Yes, that's exactly the change I've made. The test case: s = """
type MyType
a::Int
b::Int
MyType()= new()
end
"""
msgs = lintstr(s)
@assert( isempty( msgs ) ) # ok |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm calling
new()
without args in an inner constructor to avoid allocating/defining some fields until later. This causes Lint to announce an error. As far as I know this is the only way to do not define all fields when constructing a type.I'm not really sure what Lint should do here, but I think it is not necessarily wrong to use
new()
without args. Thoughts?The text was updated successfully, but these errors were encountered: