-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improve the type checker to resolve dynamic types in arguments
- Loading branch information
1 parent
f8e1586
commit 8a18423
Showing
6 changed files
with
65 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use crate::types::DataType; | ||
|
||
/// Return a clone of the first type from the list | ||
pub fn type_of_first_element(elements: &[DataType]) -> DataType { | ||
elements[0].clone() | ||
} | ||
|
||
/// Return a clone of the first array element type of first type | ||
pub fn array_element_type_of_first_element(elements: &[DataType]) -> DataType { | ||
let first_element_type = &elements[0]; | ||
match first_element_type { | ||
DataType::Array(element_type) => *element_type.clone(), | ||
_ => panic!("First element type must be an Array"), | ||
} | ||
} |
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,3 +1,4 @@ | ||
pub mod dynamic_types; | ||
pub mod environment; | ||
pub mod object; | ||
pub mod schema; | ||
|
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