forked from PistonDevelopers/dyon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for ad-hoc variables in refinement types
See PistonDevelopers#645 Use the semantics that none ad-hoc type is quantified over by `all`. - Added `Type::all_ext` - Added `Type::bind_ty_vars` - Added `Type::insert_var` - Added `Type::insert_none_var` - Added `T` lazy static string - Added some refine quantifier tests - Updated `add` in “lib.dyon” - Updated `add` extra type information - Added support for type quantifier in syntax - Push type variable names to “ty” node
- Loading branch information
Showing
16 changed files
with
263 additions
and
31 deletions.
There are no files selected for viewing
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
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,10 @@ | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
|
||
fn km(a: f64) -> km f64 {return clone(a)} | ||
|
||
fn check_km(a: km f64) {} | ||
|
||
fn main() { | ||
check_km(foo(km(2), 3)) | ||
} |
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,11 @@ | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
|
||
fn km(a: f64) -> km f64 {return clone(a)} | ||
fn m(a: f64) -> m f64 {return clone(a)} | ||
|
||
fn check_km(a: km f64) {} | ||
|
||
fn main() { | ||
check_km(foo(m(2), km(3))) | ||
} |
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,10 @@ | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
|
||
fn km(a: f64) -> km f64 {return clone(a)} | ||
|
||
fn check_km(a: km f64) {} | ||
|
||
fn main() { | ||
check_km(foo(km(2), km(3))) | ||
} |
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,8 @@ | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
|
||
fn check_f64(a: f64) {} | ||
|
||
fn main() { | ||
check_f64(foo(2, 3)) | ||
} |
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,11 @@ | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
|
||
fn km(a: f64) -> km f64 {return clone(a)} | ||
|
||
fn check_km(a: km f64) {} | ||
|
||
fn main() { | ||
// Allow no ad-hoc type before the first one. | ||
check_km(foo(2, km(3))) | ||
} |
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,15 @@ | ||
fn km(a: any) -> km any {return clone(a)} | ||
(vec4) -> km vec4 | ||
(f64) -> km f64 | ||
fn m(a: any) -> m any {return clone(a)} | ||
(vec4) -> m vec4 | ||
(f64) -> m f64 | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T vec4, T vec4) -> T vec4 } | ||
all T { (T vec4, T f64) -> T vec4 } | ||
|
||
fn check_m(a: m vec4) {} | ||
|
||
fn main() { | ||
check_m(foo(m((2, 0)), m(2))) | ||
} |
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,12 @@ | ||
fn m(a: any) -> m any {return clone(a)} | ||
(vec4) -> m vec4 | ||
(f64) -> m f64 | ||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T vec4, T vec4) -> T vec4 } | ||
all T { (T vec4, f64) -> T vec4 } | ||
|
||
fn check_m(a: m vec4) {} | ||
|
||
fn main() { | ||
check_m(foo(m((2, 0)), 2)) | ||
} |
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,18 @@ | ||
fn km(a: any) -> km any {return clone(a)} | ||
(vec4) -> km vec4 | ||
(f64) -> km f64 | ||
fn m(a: any) -> m any {return clone(a)} | ||
(vec4) -> m vec4 | ||
(f64) -> m f64 | ||
|
||
fn foo(a: any, b: any) -> any {return a + b} | ||
all T { (T f64, T f64) -> T f64 } | ||
all T { (T vec4, T vec4) -> T vec4 } | ||
all T { (T vec4, T f64) -> T vec4 } | ||
(f64, vec4) -> vec4 | ||
|
||
fn check_m(a: m vec4) {} | ||
|
||
fn main() { | ||
check_m(foo(m(2), km((1, 0)))) | ||
} |
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
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
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
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
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
Oops, something went wrong.