You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, the type (or exact type) of b isn't known when entering this block of code - but eliminating one case where the type of a becomes known, because the type of a tells me something about the type of b, I can make a safe assumption about the type of b in the remainer of the block.
Is there another way to type-cast b for the remainder of the block other than the redundant assignment b = b, which gets emitted?
If not, I'd like to suggest the compiler simply eliminate this obviously redundant self-assignment.
Alternatively, perhaps allowing some kind of declare statement might be more appropriate?
Here's the concrete example, in which typeof vNode has been narrowed down to "object", which implies target must be TargetElement.
It's not the first time I've run into this problem, and as far as I can figure, there isn't a type constraint or a trick with generics or something that will fix this - if there is, I'd love to hear about it of course, but every time I've run into this issue, self-assignment has been the only solution I could dig up.
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
I have a case similar to this:
That is, the type (or exact type) of
b
isn't known when entering this block of code - but eliminating one case where the type ofa
becomes known, because the type ofa
tells me something about the type ofb
, I can make a safe assumption about the type ofb
in the remainer of the block.Is there another way to type-cast
b
for the remainder of the block other than the redundant assignmentb = b
, which gets emitted?If not, I'd like to suggest the compiler simply eliminate this obviously redundant self-assignment.
Alternatively, perhaps allowing some kind of
declare
statement might be more appropriate?Here's the concrete example, in which
typeof vNode
has been narrowed down to"object"
, which impliestarget
must beTargetElement
.It's not the first time I've run into this problem, and as far as I can figure, there isn't a type constraint or a trick with generics or something that will fix this - if there is, I'd love to hear about it of course, but every time I've run into this issue, self-assignment has been the only solution I could dig up.
The text was updated successfully, but these errors were encountered: