-
Notifications
You must be signed in to change notification settings - Fork 12.8k
x[(0)] = 1
asserts with 'Invalid cast. The supplied value [object Object] did not pass the test 'isBindableStaticAccessExpression'.
#38934
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
Comments
Does this reproduce in the latest VS Code insiders build with all extensions disabled? |
On a brand-new install of the Insiders build, it crashes the TypeScript server: All I did was open my workspace and load the same file it crashed on before. No extensions are installed according to the viewlet. The same exception as above is produced. Issue Type: Bug TypeScript Version: 3.9.4
VS Code version: Code - Insiders 1.46.0-insider (1bfa086, 2020-06-02T08:10:00.819Z) System Info
|
@mjbvz - A number of my coworkers are experiencing this issue now as well. We are not able to identify a specific repro, but it does happen when working on our very large JavaScript-based project. I also noticed a significant increase in power consumption when it is erroring (I currently have the TS Server disabled). There is not enough information in the error to help me identify what might be tripping it up, but if you have any ideas, I'm willing to investigate. |
@sandersn Seems like a potential duplicate of #37633 @highspotjeremy Can you please try upgrading your workspace to use |
@mjbvz Is TypeScript 3.9.5 with the fix in Code 1.46 OK? Cheers! |
It's still crashing on me. |
If it helps, this is a fairly new issue. It only began happening recently with this project. |
I see from insiders with 3.9.4, this is still hitting the assert that I revised after #37633 in #38270. @highspotjeremy or @David-Else Are you able to modify your tsserver.js to dump the text of the node? We don't do this by default because it would leak source code into our telemetry. Look for this line bindStaticPropertyAssignment(ts.cast(node.left, ts.isBindableStaticNameExpression)); If you're on 3.9.1 or earlier, it'll cast with isBindableStaticAccessExpression instead, but the change is the same. Add these two lines before it: if (!ts.isBindableStaticNameExpression(node.left))
return ts.Debug.fail(`Invalid cast. The supplied value ${ts.getTextOfNode(node.left)} was not a BindableStaticNameExpression.`);
If either project is open source I'm happy to try to clone it and repro the problem myself. |
@sandersn - I ended up needing to put a try/catch around the call to The exception is happening when reading a file that is generated by The specific expression that is failing is this: new_tail[(0)] The I am able to reproduce the issue in a new JavaScript file containing the following code extracted from the offending file: (cljs.core.TransientVector.prototype.cljs$core$ITransientCollection$_conj_BANG_$arity$2 = (function (tcoll,o){
var self__ = this;
var tcoll__$1 = this;
if(self__.root.edit){
if(((self__.cnt - cljs.core.tail_off(tcoll__$1)) < (32))){
(self__.tail[(self__.cnt & (31))] = o);
(self__.cnt = (self__.cnt + (1)));
return tcoll__$1;
} else {
var tail_node = (new cljs.core.VectorNode(self__.root.edit,self__.tail));
var new_tail = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
(new_tail[(0)] = o);
(self__.tail = new_tail);
if(((self__.cnt >>> (5)) > ((1) << self__.shift))){
var new_root_array = [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null];
var new_shift = (self__.shift + (5));
(new_root_array[(0)] = self__.root);
(new_root_array[(1)] = cljs.core.new_path(self__.root.edit,self__.shift,tail_node));
(self__.root = (new cljs.core.VectorNode(self__.root.edit,new_root_array)));
(self__.shift = new_shift);
(self__.cnt = (self__.cnt + (1)));
return tcoll__$1;
} else {
var new_root = cljs.core.tv_push_tail(tcoll__$1,self__.shift,self__.root,tail_node);
(self__.root = new_root);
(self__.cnt = (self__.cnt + (1)));
return tcoll__$1;
}
}
} else {
throw (new Error("conj! after persistent!"));
}
})); |
Thanks, that's very helpful. The minimal poisonous expression is x[(0)] = 1 Clearly we never tested with nested parentheses, even though it's perfectly reasonable for machine-generated code. |
x[(0)] = 1
asserts with 'Invalid cast. The supplied value [object Object] did not pass the test 'isBindableStaticAccessExpression'.
Fix is up at #39025 |
Issue Type: Bug
TypeScript Version: 3.8.3
Steps to reproduce crash
1.
2.
3.
TS Server Error Stack
VS Code version: Code 1.45.1 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a, 2020-05-14T08:33:47.663Z)
OS version: Darwin x64 19.4.0
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Extensions (25)
(5 theme extensions excluded)
The text was updated successfully, but these errors were encountered: