-
Notifications
You must be signed in to change notification settings - Fork 153
typing: disallow TypeVar with a single constraint; add test; update conformance outputs (#1015) #1018
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
typing: disallow TypeVar with a single constraint; add test; update conformance outputs (#1015) #1018
Conversation
…onformance outputs (facebook#1015)
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.
Thanks for the PR and the tests!
I understand the goal of wanting to avoid emitting two diagnostics during cases when a user has 1 constraint & a bound type, but I believe this case is going to be extremely rare, and not worth the increased complexity in the new logic.
Let me know if you disagree
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.
Thanks, this looks cleaner. We'll try to get this merged on Tuesday.
@yangdanny97 has imported this pull request. If you are a Meta employee, you can view this in D81493328. |
Hi @yangdanny97 , I think my branch has fallen behind main, which caused the conflict in conformance/third_party/results.json and led to the internal linter showing as pending/failing. Would you like me to rebase, resolve the conformance files, and re-run tests, or will you handle the conflict on your end? |
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.
Review automatically exported from Phabricator review in Meta.
Got it, thanks for the approval. Since the conflict is only in conformance outputs, I’ll leave it to be regenerated on merge. |
Ah, sorry for missing your comment earlier! Yeah, we can rebase and regenerate the conformance output on our end. |
@yangdanny97 merged this pull request in 99bab4a. |
yeah no need to worry if the merge conflict is just in the generated files - those get automatically re-generated during the merge process |
Closes #1015
Summary
TypeVar(...)
inpyrefly/lib/alt/expr.rs
, matching the existing scoped-parameter rule inpyrefly/lib/alt/solve.rs
.T
, got 1”.bound
are present.Tests
test_typevar_single_constraint_is_error
inpyrefly/lib/test/generic_restrictions.rs
.cargo +nightly-2025-06-20 test --all
,python3 test.py
.Conformance
python3 test.py
; committed updates:conformance/third_party/conformance.exp
conformance/third_party/conformance.result
conformance/third_party/results.json
Tooling
-p pyrefly
is clean; workspace clippy warnings inpyrefly_config
are pre-existing and out of scope.Checklist
feat/typevar-min-2-constraints