@@ -181,11 +181,11 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
181181 fn actual_ty ( & self , typ : & Type ) -> Type {
182182 match * typ {
183183 Type :: Var ( ref type_var) => {
184- println ! ( "1: {:?}: {}" , typ, self . symbols. name( type_var. 0 ) ) ;
184+ // println!("1: {:?}: {}", typ, self.symbols.name(type_var.0));
185185 if let Some ( actual_type) = self . env . look_type ( type_var. 0 ) {
186- println ! ( "2" ) ;
186+ // println!("2");
187187 if typ != actual_type {
188- println ! ( "3" ) ;
188+ // println!("3");
189189 return self . actual_ty ( actual_type) ;
190190 }
191191 }
@@ -600,6 +600,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
600600 }
601601
602602 for & WithPos { node : TypeDec { ref name, ref ty, ref ty_vars, .. } , .. } in type_declarations {
603+ println ! ( "======\n Type declaration name: {}" , self . symbols. name( name. node) ) ;
603604 let has_type_args = !ty_vars. idents . is_empty ( ) ;
604605 if has_type_args {
605606 self . env . begin_type_scope ( ) ;
@@ -620,6 +621,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
620621 None
621622 } ,
622623 Declaration :: VariableDeclaration { ref init, name, ref typ, .. } => {
624+ println ! ( "********\n Var {}" , self . symbols. name( name) ) ;
623625 let exp = self . trans_exp ( init, parent_level, done_label, true ) ;
624626 let is_collectable = type_is_collectable ( & exp. ty ) ;
625627 let escape = self . env . look_escape ( name) ;
@@ -641,6 +643,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
641643 self . add_error ( Error :: RecordType { pos : declaration. pos } ) ;
642644 return None ;
643645 }
646+ println ! ( "===> ({}) Type: {:?}" , self . symbols. name( name) , exp. ty) ;
644647 let var = var_dec ( & access, exp. exp ) ;
645648 self . env . enter_var ( name, Entry :: Var { access, typ : exp. ty } ) ;
646649 Some ( var)
@@ -727,6 +730,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
727730 }
728731 } ,
729732 Expr :: Call { ref args, ref function, ref type_args } => {
733+ // TODO: use type_args.
730734 match function. node {
731735 Expr :: Variable ( ref func) => {
732736 match self . env . look_var ( func. node ) . cloned ( ) { // TODO: remove this clone.
@@ -936,6 +940,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
936940 EXP_TYPE_ERROR
937941 } ,
938942 Expr :: Field { ref ident, ref this } => {
943+ println ! ( " | Field {:?}.{:?}" , this. node, self . symbols. name( ident. node) ) ;
939944 let var = self . trans_exp ( this, level, done_label, true ) ;
940945 match var. ty {
941946 Type :: App ( TypeConstructor :: Unique ( inner_type, _) , _) => {
@@ -954,6 +959,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
954959 TypeConstructor :: Record { name : record_type, ref types, .. } => {
955960 for ( index, & ( name, ref typ) ) in types. iter ( ) . enumerate ( ) {
956961 if name == ident. node {
962+ println ! ( "Record field: {}: {:?}" , self . symbols. name( name) , typ) ;
957963 return ExpTy {
958964 exp : field_access :: < F > ( var. exp , index, FieldType :: Record ) ,
959965 ty : typ. clone ( ) ,
@@ -1195,6 +1201,7 @@ impl<'a, F: Clone + Debug + Frame + PartialEq> SemanticAnalyzer<'a, F> {
11951201 }
11961202 } ,
11971203 Expr :: Record { ref fields, ref typ, ref type_args } => {
1204+ // TODO: use type_args to replace the generic types in the record type.
11981205 let ty = self . get_type ( typ, AddError ) ;
11991206 let mut field_exprs = vec ! [ ] ;
12001207 let data_layout =
0 commit comments