Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upJS array.copy() being compiled to null() #3967
Comments
|
IMO this should be fixed in Array.copy by using |
|
I think that's a huge problem if the analyzer breaks on "untyped this" |
|
Ah, reading again I understand a bit better. |
|
It's not the analyzer, it's the constructor inlining logic. |
|
Actually I don't understand how it breaks exactly, but I think we should find a way to fix it without changing Array.copy implementation since users might have similar cases in their code |
|
I have clarified this somewhere before but I can do it again: The problem with [insert long train of thought why we may want to consider disallowing field access on unknown types] The problem is related to this match in |
|
... plus the fact that you originally designed inlined constructors to default to |
|
But then you can get the same result by doing (perfectly typed):
|
|
Yes, that's probably a problem with the constructor inlining implementation since the get go. So we indeed have to do something about that (though I still think the untyped this code is bad). |
SInce |
|
I have fixed the original issue, but the sub-typing one remains for now. |
|
We sidestep the issue now by not inlining constructors if the variable type is different. This is good enough for 3.2, but we can improve the distinction of constructor/structure inlines after that. |
|
I looked at this again and think that my type-based fix does exactly the right thing. If we do |
compile with:
output: