hm-inference #6

Merged
sb10q merged 136 commits from hm-inference into master 2021-08-19 11:46:50 +08:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit 33391c55c2 - Show all commits

View File

@ -26,7 +26,7 @@ pub enum TopLevelDef {
// ancestor classes, including itself. // ancestor classes, including itself.
ancestors: Vec<DefinitionId>, ancestors: Vec<DefinitionId>,
// symbol resolver of the module defined the class, none if it is built-in type // symbol resolver of the module defined the class, none if it is built-in type
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
}, },
Function { Function {
// prefix for symbol, should be unique globally, and not ending with numbers // prefix for symbol, should be unique globally, and not ending with numbers
@ -46,7 +46,7 @@ pub enum TopLevelDef {
/// rigid type variables that would be substituted when the function is instantiated. /// rigid type variables that would be substituted when the function is instantiated.
instance_to_stmt: HashMap<String, (Stmt<Option<Type>>, usize)>, instance_to_stmt: HashMap<String, (Stmt<Option<Type>>, usize)>,
// symbol resolver of the module defined the class // symbol resolver of the module defined the class
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
}, },
Initializer { Initializer {
class_id: DefinitionId, class_id: DefinitionId,
@ -167,7 +167,7 @@ impl TopLevelComposer {
/// already include the definition_id of itself inside the ancestors vector /// already include the definition_id of itself inside the ancestors vector
pub fn make_top_level_class_def( pub fn make_top_level_class_def(
index: usize, index: usize,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> TopLevelDef { ) -> TopLevelDef {
TopLevelDef::Class { TopLevelDef::Class {
object_id: DefinitionId(index), object_id: DefinitionId(index),
@ -182,7 +182,7 @@ impl TopLevelComposer {
pub fn make_top_level_function_def( pub fn make_top_level_function_def(
name: String, name: String,
ty: Type, ty: Type,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> TopLevelDef { ) -> TopLevelDef {
TopLevelDef::Function { TopLevelDef::Function {
name, name,
@ -196,7 +196,7 @@ impl TopLevelComposer {
pub fn register_top_level( pub fn register_top_level(
&mut self, &mut self,
ast: ast::Stmt<()>, ast: ast::Stmt<()>,
resolver: Option<Arc<Mutex<dyn SymbolResolver + Send>>>, resolver: Option<Arc<Mutex<dyn SymbolResolver + Send + Sync>>>,
) -> Result<(String, DefinitionId, Type), String> { ) -> Result<(String, DefinitionId, Type), String> {
// get write access to the lists // get write access to the lists
let ( let (