-
Notifications
You must be signed in to change notification settings - Fork 121
Extend lub/glb to more types #340
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
Merged
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
950293e
fix nits
ggreif e16f88b
reorder clauses
ggreif 96972a7
add tests
ggreif 0691fc8
implement lub/glb for objects
ggreif 63e3220
implement Tup and Array
ggreif 5365bf9
implement function type lub/glb
ggreif f05be0c
check via REPL that correct types are inferred
ggreif e0fe75a
account for Text and Array not having proper Obj subtypes
ggreif 1e0b8d2
exercise glb for variants
ggreif 4e31d50
Allow polymorphic functions, alpha-equiv still lacking
ggreif 32a82b4
lub/glb for shared
ggreif f473d10
fix thinko
ggreif 72196df
WIP: lub/glb for Var
ggreif e67d424
WIP: we create recursive types
ggreif 66151b7
add documentation and more clean-ups
ggreif ed10d51
detect Cons early and only for them add entries to the map
ggreif 77b4482
remove newline
ggreif 8dbee72
Merge branch 'master' into gabor/object-lub-glb
ggreif 9a226a6
cleanup and typo
ggreif 5ebcf78
roll back some instrumentation
ggreif fd4581e
get the primes right
ggreif 69ea4ae
use magic marker for Con that can survive into IR
ggreif f4a5d72
Merge remote-tracking branch 'origin/master' into gabor/object-lub-glb
ggreif cd0ad79
Bring back is_loop_free and use it to resolbe a TODO
ggreif b8f0dfd
ues memq
ggreif a7b7b9a
only consider con
ggreif c19c2f0
simplify
ggreif a6306b5
don't use double negation
ggreif b758ea0
remove remains of instrumentation
ggreif f3f63b9
test AST-83
ggreif b4034ff
Fix problem with Shared types lubbing to Any
ggreif be947b3
Merge remote-tracking branch 'origin/master' into gabor/object-lub-glb
ggreif 8fcc307
update tests
ggreif 6a6d806
assert on Pre
ggreif 9af8076
rename predicate
ggreif b7da13c
make sure that the Var patterns are also dealt with by eq
ggreif d29fa47
don't match Var, leave it to eq
ggreif e35adc5
compare bounds with eq_bind
ggreif aaf0d0a
simplify by pattern matching on the original types and handle Con
ggreif d5f1730
before creating a mu-type check if both names are equal
ggreif 6ecda1e
simplify
ggreif 18dbe9e
WIP: use find_opt
ggreif 1e7301b
Ensure commutativity when building the map
ggreif ce43637
add todo
ggreif 154a63b
WIP: start lub on parametrised function types
ggreif d89516f
WIP: open functions before lub/glb
ggreif 85cfdc5
add test case
ggreif 3d33358
WIP: checkpoint
ggreif ab6063f
WIP: opening the function is not the right thing
ggreif 7fd83ff
fix glb accordingly
ggreif e1a8161
Merge remote-tracking branch 'origin/master' into gabor/object-lub-glb
ggreif a2dbd2d
bring back stuff lost from master
ggreif 9243cba
undo this change
ggreif 7cbe1e3
WIP: first shot at lub/glb of bounds
ggreif e63bf62
test poly_funcs4
ggreif ec8d79b
try a last simplification before returning a µ-type
ggreif bcdcdab
Merge remote-tracking branch 'origin/master' into gabor/object-lub-glb
ggreif 5f9fe7b
some cleanup
ggreif 0b58d52
tweak
ggreif c35aab3
factor out combine_func_parts
ggreif 5586e9d
similarly factor out logic for Con
ggreif e600a5a
Merge remote-tracking branch 'origin/master' into gabor/object-lub-glb
ggreif 718533b
review fixes
ggreif 5364400
Merge branch 'master' into gabor/object-lub-glb
ggreif 8c4a81a
Merge branch 'master' into gabor/object-lub-glb
ggreif b1e5c7f
deactivate free type constructor check
ggreif 1fe8228
Change from demand-side to supply-side for short-circuiting
ggreif 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
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
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
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 |
|---|---|---|
| @@ -1,32 +1,39 @@ | ||
| type-inference.as:10.9-10.28: warning, this if has type Any because branches have inconsistent types, | ||
| type-inference.as:10.9-10.28: warning, this if has type Shared because branches have inconsistent types, | ||
| true produces | ||
| Bool | ||
| false produces | ||
| Nat | ||
| type-inference.as:11.9-11.27: warning, this if has type Any because branches have inconsistent types, | ||
| type-inference.as:11.9-11.34: warning, this if has type Any because branches have inconsistent types, | ||
| true produces | ||
| Bool | ||
| false produces | ||
| [var Nat] | ||
| type-inference.as:12.9-12.27: warning, this if has type Shared because branches have inconsistent types, | ||
| true produces | ||
| Nat | ||
| false produces | ||
| Float | ||
| type-inference.as:12.9-12.33: warning, this if has type Any because branches have inconsistent types, | ||
| type-inference.as:13.9-13.33: warning, this if has type Any because branches have inconsistent types, | ||
| true produces | ||
| () | ||
| false produces | ||
| {} | ||
| type-inference.as:13.9-13.53: warning, this if has type Any because branches have inconsistent types, | ||
| true produces | ||
| {x : Nat} | ||
| false produces | ||
| {x : var Nat} | ||
| type-inference.as:17.33-17.41: warning, the switch has type Any because branches have inconsistent types, | ||
| type-inference.as:18.33-18.41: warning, the switch has type Shared because branches have inconsistent types, | ||
| this case produces type | ||
| Bool | ||
| the previous produce type | ||
| Nat | ||
| type-inference.as:18.43-18.56: warning, the switch has type Any because branches have inconsistent types, | ||
| type-inference.as:19.33-19.47: warning, the switch has type Any because branches have inconsistent types, | ||
| this case produces type | ||
| Bool | ||
| the previous produce type | ||
| [var Nat] | ||
| type-inference.as:20.43-20.56: warning, the switch has type Shared because branches have inconsistent types, | ||
| this case produces type | ||
| Int | ||
| the previous produce type | ||
| Text | ||
| type-inference.as:78.13-78.16: type error, expected iterable type, but expression has type | ||
| type-inference.as:25.9-25.18: warning, this array has type [Shared] because elements have inconsistent types | ||
| type-inference.as:26.9-26.24: warning, this array has type [Any] because elements have inconsistent types | ||
| type-inference.as:84.13-84.16: type error, expected iterable type, but expression has type | ||
| Non |
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
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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| stdin:34.18-34.26: type error, expression of type | ||
| {get : Nat -> Int; keys : () -> {next : () -> ?Nat}; len : () -> Nat; vals : () -> {next : () -> ?Int}} | ||
| cannot produce expected type | ||
| [Int] | ||
| stdin:34.1-34.27: type error, expression of type | ||
| Nat | ||
| cannot produce expected type | ||
| () | ||
| stdin:35.18-35.26: type error, expression of type | ||
| {get : Nat -> Int; keys : () -> {next : () -> ?Nat}; len : () -> Nat; vals : () -> {next : () -> ?Int}} | ||
| cannot produce expected type | ||
| [Int] | ||
| stdin:35.1-35.27: type error, expression of type | ||
| Nat | ||
| cannot produce expected type | ||
| () | ||
| stdin:42.19-42.26: type error, literal of type | ||
| Text | ||
| does not have expected type | ||
| Non | ||
| stdin:43.19-43.44: type error, expression of type | ||
| [Char] | ||
| cannot produce expected type | ||
| Non |
Oops, something went wrong.
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 believe this will run into an infinite cycle if one of the types is an Abs con.