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
Functions with class-specific modifiers are allowed in global scope #797
Comments
Definitely not expected behavior, nonsensical modifiers should err outside On Mon, Aug 18, 2014 at 2:50 PM, Alexandros Naskos <notifications@github.com
|
Ok, I'm on to it next after implementing abstract operators :) |
I've fixed this but on a branch that sits on top of the abstract operator changes, so I'm waiting for code review on that pull request before I open this one :) |
Ahhhhh got no time to review - can you merge & I'll review later? master is unstable now so it's okay(TM). (Or maybe @zhaihj wants to review?) |
Well the tests and Travis-CI build pass and I trust the code has no side-effects, I guess I'm just treading carefully until I get accustomed to rock once more :P Anyway, I'm merging, those are pretty trivial changes |
I had a file like this: import ./internal
import math
extend Float {
absolute: static func(value: This) -> This {
value >= 0 ? value : -1 * value
}
} that used to work fine, but after this issue was closed, my file no longer compiles: "Invalid use of modifier static outside of a type declaration". What is the purpose of disallowing extensions from having static methods? |
Simple oversight from @Shamanas's part I suppose? Btw, we should have tests for this (with //! shouldfail - so that sam On Tue, Aug 19, 2014 at 10:24 AM, davidhesselbom notifications@github.com
|
It was not my intention to do that, I though that extentions where actually TypeDefs, it seems not, fixing + adding testcase. And I did add tests. :P |
But... extensions should allow static - just not 'abstract', for example On Tue, Aug 19, 2014 at 10:32 AM, Alexandros Naskos <
|
Well, I didn't have time to check it yet, but I wanted to mention the On Tue, Aug 19, 2014 at 10:35 AM, Amos Wenger fasterthanlime@gmail.com
|
Ok, I have to make it a little more specific then. |
Maybe this is overly complicating things, but what if you want to create an extension for a type, and then inherit that type? Then extensions could have use for abstract. Otherwise, I guess it's not necessary. |
Don't quote me on that but I don't think it would work. |
I guess that settles it then :) |
The greek boy is correct. No class/inheritance for addons, they're just On Tue, Aug 19, 2014 at 11:06 AM, davidhesselbom notifications@github.com
|
For example
Compiles and runs fine.
Should this be allowed behavior?
I'm tagging this as bug because I think it is not expected behavior, can you confirm @fasterthanlime ?
Edit:
Here is one more example with the three modifiers that should be disallowed
The text was updated successfully, but these errors were encountered: