-
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
Unify type_check_expr and type_check_expr_in #574
Draft
erszcz
wants to merge
29
commits into
josefs:master
Choose a base branch
from
erszcz:unify-type-check-exprs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
96df82f
wip: Use subtype . type_check_expr in place of type_check_expr_in
erszcz a23106e
Fix test/should_fail/rigid_type_variables_fail.erl
erszcz 2e0dd23
Fix test/known_problems/should_pass/binary_exhaustiveness_checking_sh…
erszcz ceb2655
Fix test/known_problems/should_fail/binary_comprehension.erl
erszcz 02df3f0
Fix test/should_fail/return_fun_fail.erl
erszcz ba3a0b9
Fix test/known_problems/should_pass/fun_subtyping.erl
erszcz ca9094d
Fix test/known_problems/should_pass/refine_comparison_should_pass.erl
erszcz 96c2b9b
Fix test/known_problems/should_pass/refine_bound_var_on_mismatch.erl
erszcz 8ca1591
Fix test/should_fail/rel_op.erl
erszcz e9fd335
Check 'case' exhaustiveness in do_type_check_expr/2
erszcz e4145b6
Fix test/known_problems/should_fail/exhaustive_expr.erl
erszcz ee3f7ec
fixup! Check 'case' exhaustiveness in do_type_check_expr/2
erszcz ed50fec
Fix test/known_problems/should_fail/case_pattern_should_fail.erl
erszcz 32b6a2c
fixup! wip: Use subtype . type_check_expr in place of type_check_expr_in
erszcz 6102c5b
Fix test/should_fail/arith_op_fail.erl
erszcz 89c3f4e
Check clauses against inferred type in do_type_check_expr/2
erszcz 093af82
Fix test/should_pass/return_fun.erl
erszcz 96f838b
fixup! Fix test/known_problems/should_pass/binary_exhaustiveness_chec…
erszcz b283f1a
Silence unnecessary Makefile echo output
erszcz 37fa124
Fix test/should_pass/refine_bound_var_pass.erl
erszcz f097860
Fix test/should_pass/record_refinement.erl
erszcz f1b6e9c
Fix test/should_pass/qlc_test.erl
erszcz 86a6c31
Fix test/should_pass/operator_subtypes.erl
erszcz 68a4b8f
Fix test/should_pass/non_neg_plus_pos_is_pos_pass.erl
erszcz fa10bee
Fix test/should_pass/iodata.erl
erszcz 390cdea
Fix test/should_pass/factorial.erl
erszcz d43dcbc
fixup! fixup! Fix test/known_problems/should_pass/binary_exhaustivene…
erszcz 64c834c
TODO: reenable broken typechecker_tests
erszcz 6210517
Reverse type order in the type_error
erszcz 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
16 changes: 16 additions & 0 deletions
16
test/known_problems/should_pass/return_fun_should_pass.erl
This file contains 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-module(return_fun_should_pass). | ||
|
||
-export([return_fun_intersection/0, | ||
return_fun_union_intersection/0]). | ||
|
||
-spec return_fun_intersection() -> fun((any()) -> integer()). | ||
return_fun_intersection() -> fun number/1. | ||
|
||
-spec return_fun_union_intersection() | ||
-> fun((atom()) -> atom()) | | ||
fun((1..3) -> integer()). | ||
return_fun_union_intersection() -> fun number/1. | ||
|
||
-spec number(integer()) -> integer(); | ||
(float()) -> float(). | ||
number(N) -> N. |
This file contains 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 |
---|---|---|
@@ -1,6 +1,9 @@ | ||
-module(return_fun). | ||
|
||
-compile([export_all, nowarn_export_all]). | ||
-export([return_fun_term/0, | ||
return_fun_fun/0, | ||
return_fun_union/0, | ||
return_fun_any_arity/0]). | ||
|
||
-spec return_fun_term() -> term(). | ||
return_fun_term() -> fun nil/0. | ||
|
@@ -14,17 +17,5 @@ return_fun_union() -> fun nil/0. | |
-spec return_fun_any_arity() -> fun((...) -> list()). | ||
return_fun_any_arity() -> fun nil/0. | ||
|
||
-spec return_fun_intersection() -> fun((any()) -> integer()). | ||
return_fun_intersection() -> fun number/1. | ||
|
||
-spec return_fun_union_intersection() | ||
-> fun((atom()) -> atom()) | | ||
fun((1..3) -> integer()). | ||
return_fun_union_intersection() -> fun number/1. | ||
Comment on lines
-20
to
-23
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. The same goes for this function. |
||
|
||
-spec nil() -> []. | ||
nil() -> []. | ||
|
||
-spec number(integer()) -> integer(); | ||
(float()) -> float(). | ||
number(N) -> N. |
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.
I know you just moved this function around, but why should this pass? The spec says that
return_fun_intersection/0
returns a function that returns an integer, but it actually returns a function that can also return a float (if I pass it a float). A function that might return a float should not be a subtype of a function that returns an integer.