-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Always allow assignment to tagged:"any" #8
Comments
Example: var a = any``;
a = "hello"; // OK
a = 1; // also OK because `a` is still type `any`
var b = a + 2; // error: mixed operand types: 'any' and 'number' |
Note (to self):
|
I don't think this check can go here, since |
Something like this maybe.... |
Yeah I think that might work for the assignment. But we'll also need to add some other handling as well. For example:
|
Shall these two cases rather go into tickets for arguments/return handling, or is it better doing it here? |
Yeah I want to handle all cases with |
Is this test case good enough?
Need test case for this one. |
That's good. Also: function foo(x) { return x; }
function bar(y) { return y; }
var a = foo(any`3`);
var b = bar(4);
foo(b); // no error
bar(a); // argument type error
a = bar(5); // ok
b = foo("oops"); // assignment type error (b) |
It reports this, so I think we might be good here.
|
There's a bug here somehow:
That should say "expected type 'number' but found type 'any'". The return value of |
I see. Is this to be resolved in this ticket or is it a part of multipass? Because without this, I can already send a PR. |
I don't think it's related to multi-pass. But it might be. If you don't think you can find/fix the bug, let's just file it as a separate issue, then you can close/merge the PR and branch, and I can take a look at why it's happening. |
Check it out, I created a PR. I'll also have a look. I added line numbers to the output, I think it helps a lot. Interesting that in the output you can see that it is implying it as any, but then sees it as undef later. |
Fixed. See PR #26. nice job on the line numbers, btw. That was on my list of things to get to (that's why I added the whole |
Merged and I see the test case now works as it should. |
BTW, make sure you look at #27 that I just filed. Nothing to do (it's not a bug), but it's a nuanced quirk that we should both keep in mind. |
* #6 Number subtypes * #6 Added 'any' check to isAssignmentAllowed * #8 any (#29) * #8 Allowing assignement to any, handling any as argument. Added line and column display to messages. * #8 indentation * checker: fixing bug where 'any' and 'undef' were confused (#26) * #6 merged any check and line number reporting. * #6 code review fixes, allowed assignment lookup improvement.
I believe this one could be closed now. |
any
isAssignemntAllowed
in other relevant places: #6 Number subtypes #28 (review)The text was updated successfully, but these errors were encountered: