-
Notifications
You must be signed in to change notification settings - Fork 35
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
Experimental constraint solver #450
Commits on Dec 30, 2022
-
Configuration menu - View commit details
-
Copy full SHA for b6ebd79 - Browse repository at this point
Copy the full SHA b6ebd79View commit details -
First iteration of the constraint solver
This is my first stab at the constraint solver. It is only very lightly tested and is not hooked in to the type checker yet.
Configuration menu - View commit details
-
Copy full SHA for 0db747f - Browse repository at this point
Copy the full SHA 0db747fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c4027c5 - Browse repository at this point
Copy the full SHA c4027c5View commit details -
Call constraint solver when checking functions
When checking toplevel functions, call the constraint solver to work out if the existential types are correct. Unimplemented: * Applying the substitution on the remaining types. * Check that the remaining constraints are compatible with the constraints declared in the spec. I fixed a few bugs in the process.
Configuration menu - View commit details
-
Copy full SHA for 8ab1daa - Browse repository at this point
Copy the full SHA 8ab1daaView commit details -
Configuration menu - View commit details
-
Copy full SHA for cdfee19 - Browse repository at this point
Copy the full SHA cdfee19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0b7ec2e - Browse repository at this point
Copy the full SHA 0b7ec2eView commit details -
Fix variable lookup bug in constraint solver
A variable might not have any constraints and that's fine!
Configuration menu - View commit details
-
Copy full SHA for 59dfb02 - Browse repository at this point
Copy the full SHA 59dfb02View commit details -
Drop constraints when typechecking unions
Keeping the constraints when checking unions requires having a union of constraints and the current implementation doesn't support that. So right now we just drop the constraints. This means that we currently don't report as many type errors as one might expect.
Configuration menu - View commit details
-
Copy full SHA for e0df9bd - Browse repository at this point
Copy the full SHA e0df9bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 19c6362 - Browse repository at this point
Copy the full SHA 19c6362View commit details -
Drop constraints from expect_*_type functions
The current representation for constraints cannot handle union types so the constraints are dropped for now. This means that some type errors will not be caught.
Configuration menu - View commit details
-
Copy full SHA for bf92627 - Browse repository at this point
Copy the full SHA bf92627View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd0fbef - Browse repository at this point
Copy the full SHA cd0fbefView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f9df31 - Browse repository at this point
Copy the full SHA 2f9df31View commit details -
Configuration menu - View commit details
-
Copy full SHA for 60466f1 - Browse repository at this point
Copy the full SHA 60466f1View commit details -
Update expect_fun_type1 to the new instantiate_fun_type
The function instantiate_fun_type now returns constraints which have to be propagated. This was caught by dialyzer
Configuration menu - View commit details
-
Copy full SHA for 9ef6700 - Browse repository at this point
Copy the full SHA 9ef6700View commit details -
Configuration menu - View commit details
-
Copy full SHA for b6f3af6 - Browse repository at this point
Copy the full SHA b6f3af6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 083d901 - Browse repository at this point
Copy the full SHA 083d901View commit details -
Configuration menu - View commit details
-
Copy full SHA for 83635c6 - Browse repository at this point
Copy the full SHA 83635c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd65e7c - Browse repository at this point
Copy the full SHA cd65e7cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 975f31f - Browse repository at this point
Copy the full SHA 975f31fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9e3a7c3 - Browse repository at this point
Copy the full SHA 9e3a7c3View commit details -
Add a type var / union / case expr test
Test that a type var is solved to a union type given there's a case expression with multiple patterns matching on an actual var the type var is assigned to.
Configuration menu - View commit details
-
Copy full SHA for 9544819 - Browse repository at this point
Copy the full SHA 9544819View commit details -
Configuration menu - View commit details
-
Copy full SHA for cdd8ac1 - Browse repository at this point
Copy the full SHA cdd8ac1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7b563f1 - Browse repository at this point
Copy the full SHA 7b563f1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1268d93 - Browse repository at this point
Copy the full SHA 1268d93View commit details -
Configuration menu - View commit details
-
Copy full SHA for 642dbfe - Browse repository at this point
Copy the full SHA 642dbfeView commit details -
Fix self-check issue of #constraints{} field unavailable when checkin…
…g typechecker.erl This is probably a bug, since this record is not accessed directly in typechecker.erl, but a crash in get_record_fields() still happened.
Configuration menu - View commit details
-
Copy full SHA for 4a57eed - Browse repository at this point
Copy the full SHA 4a57eedView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7875be9 - Browse repository at this point
Copy the full SHA 7875be9View commit details -
Configuration menu - View commit details
-
Copy full SHA for cb6131d - Browse repository at this point
Copy the full SHA cb6131dView commit details -
Don't print the column in constraint violation ('not a subtype of') e…
…rrors The columns are always 1 as they're taken from the enclosing function location.
Configuration menu - View commit details
-
Copy full SHA for 02a8e48 - Browse repository at this point
Copy the full SHA 02a8e48View commit details -
Configuration menu - View commit details
-
Copy full SHA for cc19d7e - Browse repository at this point
Copy the full SHA cc19d7eView commit details -
Configuration menu - View commit details
-
Copy full SHA for e1d90d7 - Browse repository at this point
Copy the full SHA e1d90d7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7220b6e - Browse repository at this point
Copy the full SHA 7220b6eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a1eb2d - Browse repository at this point
Copy the full SHA 6a1eb2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e0f412 - Browse repository at this point
Copy the full SHA 4e0f412View commit details -
Configuration menu - View commit details
-
Copy full SHA for c2d3bc2 - Browse repository at this point
Copy the full SHA c2d3bc2View commit details -
Configuration menu - View commit details
-
Copy full SHA for e441263 - Browse repository at this point
Copy the full SHA e441263View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1765c3f - Browse repository at this point
Copy the full SHA 1765c3fView commit details -
Fix instantiate/2 spec and type checking error
This is equivalent to the problem of typelib:remove_pos() which couldn't type check, as it declared accepting a type(), whereas in fact some clauses it had matched type() inner nodes, not the top level nodes. type() seems to be quite an unwieldy representation :/
Configuration menu - View commit details
-
Copy full SHA for 4f8c49a - Browse repository at this point
Copy the full SHA 4f8c49aView commit details -
Configuration menu - View commit details
-
Copy full SHA for c27a693 - Browse repository at this point
Copy the full SHA c27a693View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e3258b - Browse repository at this point
Copy the full SHA 0e3258bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 099116d - Browse repository at this point
Copy the full SHA 099116dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8584a9b - Browse repository at this point
Copy the full SHA 8584a9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for b595e89 - Browse repository at this point
Copy the full SHA b595e89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00bc397 - Browse repository at this point
Copy the full SHA 00bc397View commit details -
Configuration menu - View commit details
-
Copy full SHA for c58515c - Browse repository at this point
Copy the full SHA c58515cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 22786c3 - Browse repository at this point
Copy the full SHA 22786c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3c3d398 - Browse repository at this point
Copy the full SHA 3c3d398View commit details -
Configuration menu - View commit details
-
Copy full SHA for d82a03f - Browse repository at this point
Copy the full SHA d82a03fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 29007ed - Browse repository at this point
Copy the full SHA 29007edView commit details -
Configuration menu - View commit details
-
Copy full SHA for d9f465a - Browse repository at this point
Copy the full SHA d9f465aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b77f09 - Browse repository at this point
Copy the full SHA 9b77f09View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7530e12 - Browse repository at this point
Copy the full SHA 7530e12View commit details
Commits on Dec 31, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 20cb6fc - Browse repository at this point
Copy the full SHA 20cb6fcView commit details -
Configuration menu - View commit details
-
Copy full SHA for e0394a5 - Browse repository at this point
Copy the full SHA e0394a5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1339e00 - Browse repository at this point
Copy the full SHA 1339e00View commit details -
Configuration menu - View commit details
-
Copy full SHA for 50c1530 - Browse repository at this point
Copy the full SHA 50c1530View commit details -
Configuration menu - View commit details
-
Copy full SHA for f3a5547 - Browse repository at this point
Copy the full SHA f3a5547View commit details -
Configuration menu - View commit details
-
Copy full SHA for f5a2e9b - Browse repository at this point
Copy the full SHA f5a2e9bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4c88113 - Browse repository at this point
Copy the full SHA 4c88113View commit details -
Configuration menu - View commit details
-
Copy full SHA for d632a90 - Browse repository at this point
Copy the full SHA d632a90View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a12b2f - Browse repository at this point
Copy the full SHA 3a12b2fView commit details -
Rename: test/should_pass/{=> poly_}lists_map_constraints_pass.erl
Also add the `solve_constraints` attribute.
Configuration menu - View commit details
-
Copy full SHA for eced46c - Browse repository at this point
Copy the full SHA eced46cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 46d90e4 - Browse repository at this point
Copy the full SHA 46d90e4View commit details -
Rename: test/should_pass/poly_lists_map_constraints_pass.erl -> test/…
…known_problems/should_pass/poly_lists_map_constraints_should_pass.erl
Configuration menu - View commit details
-
Copy full SHA for 5c9f58b - Browse repository at this point
Copy the full SHA 5c9f58bView commit details -
Move tests from test/known_problems/should_fail/poly_union_lower_boun…
…d_should_fail.erl to test/should_fail/poly_union_lower_bound_fail.erl
Configuration menu - View commit details
-
Copy full SHA for 68f0116 - Browse repository at this point
Copy the full SHA 68f0116View commit details -
Move tests from test/known_problems/should_fail/poly_should_fail.erl …
…to test/should_fail/poly_fail.erl
Configuration menu - View commit details
-
Copy full SHA for c800934 - Browse repository at this point
Copy the full SHA c800934View commit details -
Move test from test/should_pass/poly_union_lower_bound_pass.erl to te…
…st/known_problems/should_pass/poly_lists_map_constraints_should_pass.erl
Configuration menu - View commit details
-
Copy full SHA for a84487d - Browse repository at this point
Copy the full SHA a84487dView commit details -
Configuration menu - View commit details
-
Copy full SHA for dcc11c7 - Browse repository at this point
Copy the full SHA dcc11c7View commit details -
Rename: test/known_problems/should_pass/poly_lists_map_constraints_sh…
…ould_pass.erl -> test/should_pass/poly_lists_map_constraints_pass.erl
Configuration menu - View commit details
-
Copy full SHA for 1ffa0e0 - Browse repository at this point
Copy the full SHA 1ffa0e0View commit details -
Add test to test/known_problems/should_pass/poly_should_pass.erl
Based on: -spec get_unassigned_fields(Fields, All) -> [atom()] when Fields :: [record_field() | typed_record_field()], All :: [typed_record_field()]. get_unassigned_fields(Fields, All) -> FieldNames = lists:flatmap(fun (?record_field(Field)) -> [Field]; (?typed_record_field(Field)) -> [Field]; %% We might run into values like this, which don't match above: %% {record_field, _, {var,{12,11},'_'}, _} (_) -> [] end, Fields), AllNames = lists:map(fun (?typed_record_field(Field)) -> Field end, All), AllNames -- FieldNames. Which currently raises: ebin/typechecker.beam: Lower bound record_field() | typed_record_field() of type variable A_typechecker_3467_838 on line 2026 is not a subtype of {A_typechecker_3467_838_typechecker_1226_848, A_typechecker_3467_838_typechecker_1226_849, A_typechecker_3467_838_typechecker_1226_850}
Configuration menu - View commit details
-
Copy full SHA for 8a5722a - Browse repository at this point
Copy the full SHA 8a5722aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 95de84f - Browse repository at this point
Copy the full SHA 95de84fView commit details -
Move test from test/known_problems/should_pass/poly_should_pass.erl t…
…o test/should_pass/poly_union_lower_bound_pass.erl
Configuration menu - View commit details
-
Copy full SHA for 13f552b - Browse repository at this point
Copy the full SHA 13f552bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 34f76af - Browse repository at this point
Copy the full SHA 34f76afView commit details -
Drop any_subtype() Cs argument to make it clear we should start from …
…empty constraints
Configuration menu - View commit details
-
Copy full SHA for f29449b - Browse repository at this point
Copy the full SHA f29449bView commit details -
Configuration menu - View commit details
-
Copy full SHA for c3499a1 - Browse repository at this point
Copy the full SHA c3499a1View commit details -
Configuration menu - View commit details
-
Copy full SHA for f2aa9da - Browse repository at this point
Copy the full SHA f2aa9daView commit details -
Configuration menu - View commit details
-
Copy full SHA for d8ef301 - Browse repository at this point
Copy the full SHA d8ef301View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8c6f5c3 - Browse repository at this point
Copy the full SHA 8c6f5c3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3961582 - Browse repository at this point
Copy the full SHA 3961582View commit details -
Configuration menu - View commit details
-
Copy full SHA for 796c56f - Browse repository at this point
Copy the full SHA 796c56fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 94d9d6a - Browse repository at this point
Copy the full SHA 94d9d6aView commit details -
Add test to test/should_pass/poly_union_lower_bound_pass.erl
Based on: -spec combine_clauses_argument_constraints([type()], constraints:t(), map(), env()) -> constraints:t(). combine_clauses_argument_constraints(ArgsTys, Cs, CatchAllArgs, Env) -> ArgsTyVars = lists:flatmap(fun ({var, _, Var}) -> [Var]; (_) -> [] end, ArgsTys), ... The catch-all pattern does not register a constraint, while the tuple pattern does. Because of that the type checker fails matching any type() with the funs clauses and returns a warning, even though any type() instance will be handled by the fun.
Configuration menu - View commit details
-
Copy full SHA for 80afeee - Browse repository at this point
Copy the full SHA 80afeeeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1f78c53 - Browse repository at this point
Copy the full SHA 1f78c53View commit details -
Configuration menu - View commit details
-
Copy full SHA for ebbd798 - Browse repository at this point
Copy the full SHA ebbd798View commit details -
Configuration menu - View commit details
-
Copy full SHA for d9e2bfd - Browse repository at this point
Copy the full SHA d9e2bfdView commit details