-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Fix #33436 #33445
Fix #33436 #33445
Conversation
All baseline changes are either:
|
https://github.com/microsoft/TypeScript/pull/30637/files?file-filters%5B%5D=.ts The above PR did not modify I looked over it quickly but it looks like So, while the constraint is And this PR is just updating the sentinel type to match the reality? Sorry if I sound incoherent =( |
The error message is a consequence of the fact that In other words, the error message logic does not look for the sentinel specifically, so it wasn't clear to me whether other code would be the same. I don't know what else uses The default constraint should be |
{}
to unknown
.
Right, |
OK, so this error changes because |
So From a brief look I don't think it is leaking into comparisons, at least judging by the direct accesses to Given the churn on baselines, should we leave this until the outcome of #33436 is finalised? I wasn't sure if that was still in discussion. |
I think #33436 is pretty directly an artifact of not checking for
Yeah, I think so. |
If Then again why do we need a sentinel at all? It seems like if |
No. That's a |
Okay then I’m confused. The way you described it before sounded like “no constraint” was being represented internally as |
|
No, I get that - my question is, what makes |
It's never supposed to be witnessed as a type. So nothing. It could be a clone of the number |
So... Better to leave it as Was there a reason to not just use Just curious =x |
f2ca85d
to
e52b5cb
Compare
tests/baselines/reference/complexRecursiveCollections.errors.txt
Outdated
Show resolved
Hide resolved
tests/baselines/reference/objectTypeWithRecursiveWrappedPropertyCheckedNominally.errors.txt
Outdated
Show resolved
Hide resolved
Probably to distinguish between types known to have no constraints, and types with lazy constraints not computed yet. I updated the other sentinels, just because, but I'm happy to revert those changes. Most of the baselines look fine. I marked a couple I'm not sure about. |
{}
to unknown
.{}
to unknown
and fix #33436
|
Why was this closed? o.0 |
I don't think there was an associated issue and I'm just doing my bit to keep the random open PR count down. Can always reopen if there is need! |
Isn't #33436 the associated issue? =x |
{}
to unknown
and fix #33436
Yes, you're right. |
@@ -1,4 +1,17 @@ | |||
tests/cases/compiler/immutable.ts(341,22): error TS2430: Interface 'Keyed<K, V>' incorrectly extends interface 'Collection<K, V>'. | |||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotta remove this
} | ||
|
||
function f2<A, B extends A>(a: Contravariant<A>, b: Contravariant<B>) { | ||
a = b; // Error | ||
~ | ||
!!! error TS2322: Type 'Contravariant<B>' is not assignable to type 'Contravariant<A>'. | ||
!!! error TS2322: Type 'A' is not assignable to type 'B'. | ||
!!! error TS2322: 'A' is assignable to the constraint of type 'B', but 'B' could be instantiated with a different subtype of constraint '{}'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous error message is wrong ({}
isn't "interesting" constraint), but shouldn't the user still see an error message here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably the user still sees Type 'A' is not assignable to type 'B'.
, but I haven't added the elaboration from the linked proposal of:
'B' could be instantiated with an arbitrary type which could be unrelated to 'A'.
ec518df
to
f2ca85d
Compare
@DanielRosenwasser Closing this in favor of #35225 as I messed up some merges. |
No description provided.