-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use vec instead of map, add generics to index
- Loading branch information
Showing
13 changed files
with
113 additions
and
184 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
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,2 +1,3 @@ | ||
// Copyright (c) 2020 Ghaith Hachem and Mathias Rieder | ||
mod index_tests; | ||
mod generic_tests; |
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,19 @@ | ||
use pretty_assertions::assert_eq; | ||
|
||
use crate::{ast::GenericBinding, test_utils::tests::index, typesystem::DataTypeInformation}; | ||
|
||
#[test] | ||
fn generics_saved_in_index() { | ||
let (_,index) = index(r" | ||
FUNCTION foo<T: ANY> : T; END_FUNCTION | ||
"); | ||
|
||
let foo_info = index.find_effective_type_info("foo").unwrap(); | ||
assert!(foo_info.is_generic()); | ||
if let DataTypeInformation::Struct{ generics, .. } = foo_info { | ||
let t = &generics[0]; | ||
assert_eq!(&GenericBinding{ name: "T".into(), nature: "ANY".into()}, t); | ||
} else { | ||
panic!("{:#?} not a struct", foo_info); | ||
} | ||
} |
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.