Closed JSAbrahams closed 1 year ago
Add issue that we should only override identifiers with Python type in:
Merging #439 (cb8fb18) into develop (7d06ae2) will decrease coverage by
0.13%
. The diff coverage is85.27%
.
@@ Coverage Diff @@
## develop #439 +/- ##
===========================================
- Coverage 88.59% 88.46% -0.14%
===========================================
Files 110 107 -3
Lines 11956 11729 -227
===========================================
- Hits 10593 10376 -217
+ Misses 1363 1353 -10
Impacted Files | Coverage Δ | |
---|---|---|
src/check/constrain/constraint/iterator.rs | 84.61% <0.00%> (ø) |
|
src/check/constrain/unify/mod.rs | 75.00% <ø> (ø) |
|
src/check/context/field/mod.rs | 54.28% <ø> (ø) |
|
src/generate/convert/control_flow.rs | 90.25% <ø> (ø) |
|
src/parse/lex/result.rs | 14.28% <0.00%> (ø) |
|
src/parse/result.rs | 43.07% <0.00%> (ø) |
|
src/check/result.rs | 76.92% <33.33%> (+1.36%) |
:arrow_up: |
src/generate/convert/ty.rs | 57.14% <33.33%> (-12.25%) |
:arrow_down: |
src/check/context/parent/mod.rs | 42.85% <42.85%> (ø) |
|
src/check/context/arg/generic.rs | 76.54% <50.00%> (ø) |
|
... and 71 more |
Relevant issues
Summary
As has been a running theme for the past few days, this PR changes quite a lot more than originally intended. However, we had some sloppy code which I figured would be best to clean up now instead of laborously splitting it over many PR's. For now I see this a one in a set of major refactors, which for now is fine since I'm the only active developer. Best to just improve the quality of the codebase now and get rid of as many bugs as possible by generalizing the type system as much as possible. This includes getting rid of as much superfluous logic as possible.
Main change:
Except::Collection
toExpect::Call { ... }
Remove the collection Expect construct. Instead, we use generics now and substitution of generics to deal with unification of collections.
Collection
type in annotatedAST
since that is not a valid type annotation in Python.This greatly simplifies a lot of exceptions we had to make for collections. We also get to make use of type annotation logic now.
Secondary: Remove
NameVariant
Instead, we just make use of
Tuple[...]
andCallable[Tuple[...],[...]
by making helper methods which create these for us on the fly. Under the hood, it's alwaysStringName
. For now, I leave optionality untouched, so we don't make use ofOptional[...]
, but instead have a boolean inTrueName
.This makes it much easier to match names directly and simplifies a lot of substitution logic within
Name
. The changes here don't affect the codebase outside ofname
too much, because most of it was abstracted away. But it does greatly reduce the chances of introducing a bug. And it also simplifies the unification stage even further.To accomodate these changes, we also revamp the generic system:
lit
s inStringName { lit1, generics: [Name] }
), we check proceed to check for each generic whether self is name of other as long as the generic count is the same.Added Tests
TODO: list tests