-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
Analyzer regression #5082
Comments
That would be #4787, and goddammit who writes code like that... |
I can't promise a fix for the RC. My naive attempts cause failing tests for #1827 and something going wrong in TestInt64. I would like to point out that |
It it because of the untyped? Or can the analyzer loose |
Does no seem to be untyped-specific, since doing the following produces the same output, while being perfectly valid:
This is a serious regression IMHO (silently fails at runtime and hard to pinpoint) |
Trying also the following, not working either:
|
It can happen with Dynamic and open structures when you expect to retain native semantics, which I find to be pretty crazy to begin with. In the general case the |
@Simn this is not native semantics, this is because you're not creating a TClosure when making the .spectrum field access as you should. |
Wait, that's the issue? Why didn't |
It's written in my first post :) |
This might help with your actual case because we have an FAnon field access there, but it wouldn't help with Dynamic. There's no FClosure for Dynamic. |
Actually it doesn't even help with your actual case. This is what the AST has because you make the
Note the |
There's nothing I can do here for the RC. I'll have to discuss this with Nicolas afterwards. |
Note that I still don't know what to do with this. If you have any smart idea please let me know. |
I don't see much of a solution here expect preventing the analyzer to create tmp vars which are TFun fields accesses, Because even if they were closures, this might lead to allocating some memory and we don't want that. |
Clarifying: we can create a TFun tmp if it comes from a class var, but not from a class method, and not from an anon either. |
Yes but the problem is that due to your untyped we don't know if it's a var or a method. The |
Yes, you have to look at the object as well, if it's a TInst then you are allowed to create a tmp Var, if not then you should not do it. |
That still doesn't sound quite right to me, but I'll take a look. |
I have applied the fix as you suggested. I still don't think it's foolproof like that, but it probably requires some maliciousness to cause problems with it. |
I know there was a similar opened issue but I can't find it anymore.
In CastleDB, I am doing the following:
This now gets compiled to:
But in JS this will get the wrong "this", creating a runtime error
If you want to keep this behavior, it is necessary to use a FClosure field access on
.spectrum
The text was updated successfully, but these errors were encountered: