-
Notifications
You must be signed in to change notification settings - Fork 136
don't allow overriding a namedtuple element #584
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
224ab4d
done with the text and feature
vagabond-0 776df8b
changed
vagabond-0 6d79519
move some match cases around
yangdanny97 c0140c3
Make BindingExpect 1 word bigger and avoid Box's
ndmitchell f3a1139
Push some Box down
ndmitchell 0804080
Handle dataclass field kw_only overrides (#566)
pt2302 08f5893
Create a more flexible (private, for now) interface for `Calculation`.
stroxler 67c81fb
Inline `calculate_with_recursive` logic to `get_idx`
stroxler 6c7c86d
Define an ordering for `CalcId`
stroxler dc77fde
Create plumbing for cycle breaking
stroxler 3da165b
Move `current_cycle` logic to `CalcStack`
stroxler d0de206
Use Vec1 for the cycle
stroxler 2557d7a
Use `AnswersSolver::new` from `Answers`
stroxler b4c1033
Factor `AnswersSolver` out of `answers.rs`
stroxler 0a603f6
Define the `Cycle` data structure, implement `Cycle::new`
stroxler 62ebbe0
Add a `cycle_detected` method to `Cycles`
stroxler 4c95daa
Add cycle state logic
stroxler ef5de94
Compute `current` in `get_idx`
stroxler f0638e9
Factor some things out of `get_idx`
stroxler e855ee6
Simplify `get_idx` a bit
stroxler 83f2a8c
Simplify `get_idx` a bit more
stroxler c01ac04
Tweak `Cycles` apis a bit
stroxler cddb056
specify newlines for conformance output
yangdanny97 81d1f00
do not auto-import builtins
kinto0 bce8a9b
Fix a lint
ndmitchell 129f6c3
Fix up test_find_module_prefixes (#576)
ndmitchell 4990bf1
Make Unique/Var zero's with const
ndmitchell e057de1
Hardcode ::Recursive to Var
ndmitchell 27b9752
Delete SolveRecursive
ndmitchell bba1d2a
Propagate TypedDict's update type hint to expression type inference
migeed-z f58d10f
make magic_dunder_attr lookup use get_possible_attribute_bases (#577)
yangdanny97 620c009
Implement ReadOnlyReason for specific error messages (#570)
Adist319 8a6d975
add mypy_primer to github CI (#565)
yangdanny97 0684127
Record a bug with Mapping.get
ndmitchell 1e6ce50
Add extra cache clearing functionality for LSP
connernilsen e87a982
rebased
vagabond-0 a117840
Merge branch 'main' into issue#568
vagabond-0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1146,6 +1146,19 @@ impl<'a, Ans: LookupAnswer> AnswersSolver<'a, Ans> { | |
|
||
for (parent, parent_metadata) in parents { | ||
parent_has_any = parent_has_any || parent_metadata.has_base_any(); | ||
//don't allow overriding a namedtuple element | ||
if let Some(named_tuple_metadata) = parent_metadata.named_tuple_metadata() { | ||
if named_tuple_metadata.elements.contains(name) { | ||
self.error( | ||
errors, | ||
range, | ||
ErrorKind::BadOverride, | ||
None, | ||
format!("Cannot override named tuple element `{}`", name), | ||
); | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should early return here |
||
} | ||
} | ||
let Some(want_member) = self.get_class_member(parent.class_object(), name) else { | ||
continue; | ||
}; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: space after
//