Skip to content
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

Checker doesn't take largest demoninator #296

Open
JSAbrahams opened this issue May 23, 2022 · 1 comment
Open

Checker doesn't take largest demoninator #296

JSAbrahams opened this issue May 23, 2022 · 1 comment
Assignees
Labels
bug: check Something in the type check module isn't working (as intended)

Comments

@JSAbrahams
Copy link
Owner

Description of Bug

Type checker does not take largest demoninator.

How to Reproduce

def a := 10

a += 2
a -= 3
a *= 6

a /= 7
a ^= 2

a <<= 10
a >>= 5

Expected behavior

Results in type checker tripping on a, should be Float but checker assumes it is Int.

@JSAbrahams JSAbrahams added the bug: check Something in the type check module isn't working (as intended) label May 23, 2022
@JSAbrahams JSAbrahams added this to the Match statements (v0.3.3) milestone May 23, 2022
@JSAbrahams JSAbrahams added this to Needs triage in Fixing Language Bugs via automation May 23, 2022
JSAbrahams added a commit that referenced this issue Jun 24, 2022
We should modify the context such that it read
Python files and cna deal with function
overloading.
When checking, it should then pick the correct
function and use its return type when checking.
Should also work for constructors.

- Potentially could help fix #296
@JSAbrahams JSAbrahams pinned this issue Nov 18, 2022
@JSAbrahams
Copy link
Owner Author

Lets move to next milestone since this might require a non-trivial restructuring.

JSAbrahams added a commit that referenced this issue Dec 28, 2022
This means that in certain situations, a Name is
a superset of another if it is a superset of just
one of the types of other.

For now, this is useful at a function call site
where we generate such constraints on the fly.
There, we only need the current expression to be
super of one.

However, seeing as we only have one use case at
the moment, I'm not sure this logic belongs in
Name itself.
Perhaps this might be useful in future for fixing
other issues.
Issues such as #296 come to mind.

- Unignore certain mutability test.
JSAbrahams added a commit that referenced this issue Dec 28, 2022
* [ci skip] Add test assign to nullable class field

* [ci skip] Fix field access constraint generation

However now we have an issue that primitive
comparisons seems to trip up.

Something is up with how we generate constraints
on the fly for field access in conjunction with
function access.

If we flip back the field_ty_exp, then we no
longer get the failed definition_ast_verify test.
It seems that if we fix the issue with the Union,
we get nullability check issues and vice versa.

* Some cleanup

* Substitute also assumes constraints mutable ref

- reinsert also assumes constraint mutable ref
- Improve Position Display
- Improve Constraint Display
- Improve access logic

* [ci skip] Field type super in field access gen

* Add exception that Name may be super of any

This means that in certain situations, a Name is
a superset of another if it is a superset of just
one of the types of other.

For now, this is useful at a function call site
where we generate such constraints on the fly.
There, we only need the current expression to be
super of one.

However, seeing as we only have one use case at
the moment, I'm not sure this logic belongs in
Name itself.
Perhaps this might be useful in future for fixing
other issues.
Issues such as #296 come to mind.

- Unignore certain mutability test.

* Cleanup
JSAbrahams added a commit that referenced this issue Dec 28, 2022
* [ci skip] Add test assign to nullable class field

* [ci skip] Fix field access constraint generation

However now we have an issue that primitive
comparisons seems to trip up.

Something is up with how we generate constraints
on the fly for field access in conjunction with
function access.

If we flip back the field_ty_exp, then we no
longer get the failed definition_ast_verify test.
It seems that if we fix the issue with the Union,
we get nullability check issues and vice versa.

* Some cleanup

* Substitute also assumes constraints mutable ref

- reinsert also assumes constraint mutable ref
- Improve Position Display
- Improve Constraint Display
- Improve access logic

* [ci skip] Field type super in field access gen

* Add exception that Name may be super of any

This means that in certain situations, a Name is
a superset of another if it is a superset of just
one of the types of other.

For now, this is useful at a function call site
where we generate such constraints on the fly.
There, we only need the current expression to be
super of one.

However, seeing as we only have one use case at
the moment, I'm not sure this logic belongs in
Name itself.
Perhaps this might be useful in future for fixing
other issues.
Issues such as #296 come to mind.

- Unignore certain mutability test.

* Cleanup
@JSAbrahams JSAbrahams self-assigned this Dec 30, 2022
@JSAbrahams JSAbrahams changed the title Type checker does not take largest demoninator Checker doesn't take largest demoninator Jan 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: check Something in the type check module isn't working (as intended)
Projects
No open projects
Fixing Language Bugs
  
Needs triage
Development

No branches or pull requests

1 participant