@@ -514,11 +514,7 @@ fn unify_open_records(
514514 return Err ( NuError :: type_error ( "Incompatible record types: both sides require additional fields \
515515 that cannot be reconciled"
516516 . to_string ( ) ,
517- span,
518- expected_type: None ,
519- found_type: None ,
520- similar_names: None ,
521- ) ) ;
517+ span) ) ;
522518 }
523519 let fresh_row = TypeVar :: fresh ( ) ;
524520 let s = mgu (
@@ -554,19 +550,15 @@ fn unify_open_records(
554550 // Row tails are always fresh type variables by construction; a
555551 // residual non-variable tail cannot absorb fields.
556552 _ => Err ( NuError :: type_error ( "Incompatible record types: the rows cannot be unified" . to_string ( ) ,
557- span,
558- expected_type: None ,
559- found_type: None ,
560- similar_names: None ,
561- ) ) ,
553+ span) ) ,
562554 }
563555}
564556
565557/// Unify a list of type variable / type pairs (common sub-structures).
566558fn unify_many_app ( types1 : & [ Type ] , types2 : & [ Type ] , span : Span ) -> NuResult < Substitution > {
567559 if types1. len ( ) != types2. len ( ) {
568560 return Err ( NuError :: type_mismatch (
569- format ! ( "type list of length {) " , types1. len( ) ) ,
561+ format ! ( "type list of length {} " , types1. len( ) ) ,
570562 format ! ( "type list of length {}" , types2. len( ) ) ,
571563 span,
572564 ) ) ;
@@ -583,7 +575,7 @@ fn unify_many_app(types1: &[Type], types2: &[Type], span: Span) -> NuResult<Subs
583575fn unify_many ( types1 : & [ Type ] , types2 : & [ Type ] , span : Span ) -> NuResult < Substitution > {
584576 if types1. len ( ) != types2. len ( ) {
585577 return Err ( NuError :: type_mismatch (
586- format ! ( "list of {) types" , types1. len( ) ) ,
578+ format ! ( "list of {} types" , types1. len( ) ) ,
587579 format ! ( "list of {} types" , types2. len( ) ) ,
588580 span,
589581 ) ) ;
@@ -1320,22 +1312,16 @@ impl TypeChecker {
13201312 } else {
13211313 available. join( ", " )
13221314 }
1323- ) , * span,
1324- expected_type: None ,
1325- found_type: None ,
1326- similar_names: None , ) ) ;
1315+ ) , * span) ) ;
13271316 }
13281317 Some ( params) => {
1329- if args. len ( ) != params. len ( ) {
1318+ if args. len ( ) != params. 1 . len ( ) {
13301319 return Err ( NuError :: type_error ( format ! (
13311320 "Event '{}' expects {} argument(s), got {}" ,
13321321 event,
1333- params. len( ) ,
1322+ params. 1 . len( ) ,
13341323 args. len( )
1335- ) , * span,
1336- expected_type: None ,
1337- found_type: None ,
1338- similar_names: None , ) ) ;
1324+ ) , * span) ) ;
13391325 }
13401326 }
13411327 }
@@ -1598,11 +1584,7 @@ impl TypeChecker {
15981584 expected_count,
15991585 arg_types. len( )
16001586 ) ,
1601- span,
1602- expected_type: None ,
1603- found_type: None ,
1604- similar_names: None ,
1605- ) ) ;
1587+ span) ) ;
16061588 }
16071589 }
16081590
@@ -1646,7 +1628,7 @@ impl TypeChecker {
16461628 name : & str ,
16471629 ann : Option < & Type > ,
16481630 value : & Expr ,
1649- body : & Expr , Span ,
1631+ body : & Expr , span : Span ,
16501632 ) -> NuResult < ( Substitution , Type ) > {
16511633 // For let-bound lambdas that reference themselves (e.g.
16521634 // `let fac = fn(n) ... fac(n-1) ... in ...`), make the binding name
@@ -2335,7 +2317,7 @@ impl TypeChecker {
23352317 & mut self ,
23362318 ctx : & TypeContext ,
23372319 arr : & Expr ,
2338- idx : & Expr , Span ,
2320+ idx : & Expr , span : Span ,
23392321 ) -> NuResult < ( Substitution , Type ) > {
23402322 let ( s1, arr_ty) = self . infer_expr ( ctx, arr) ?;
23412323 let ctx1 = apply_subst_to_ctx ( ctx, & s1) ;
@@ -2355,13 +2337,14 @@ impl TypeChecker {
23552337 let final_subst = compose_subst ( & s_arr, & s_combined) ;
23562338
23572339 Ok ( ( final_subst. clone ( ) , apply_subst ( & elem_var, & final_subst) ) )
2340+ }
23582341
23592342 /// Infer the type of a pattern match expression.
23602343 fn infer_match (
23612344 & mut self ,
23622345 ctx : & TypeContext ,
23632346 scrutinee : & Expr ,
2364- arms : & [ ( Pattern , Option < Expr > , Expr ) ] , Span ,
2347+ arms : & [ ( Pattern , Option < Expr > , Expr ) ] , span : Span ,
23652348 ) -> NuResult < ( Substitution , Type ) > {
23662349 // Infer scrutinee type
23672350 let ( s1, scrut_ty) = self . infer_expr ( ctx, scrutinee) ?;
@@ -2390,11 +2373,7 @@ impl TypeChecker {
23902373 }
23912374 if arm_types. is_empty ( ) {
23922375 return Err ( NuError :: type_error ( "Match expression with no arms" . to_string ( ) ,
2393- span,
2394- expected_type: None ,
2395- found_type: None ,
2396- similar_names: None ,
2397- ) ) ;
2376+ span) ) ;
23982377 }
23992378
24002379 // Unify all arm types
@@ -2578,7 +2557,7 @@ impl TypeChecker {
25782557 fn infer_spawn (
25792558 & mut self ,
25802559 ctx : & TypeContext ,
2581- actor_type : & Expr , Span ,
2560+ actor_type : & Expr , span : Span ,
25822561 ) -> NuResult < ( Substitution , Type ) > {
25832562 let ( s, actor_ty) = self . infer_expr ( ctx, actor_type) ?;
25842563 match & actor_ty {
@@ -2808,8 +2787,6 @@ impl TypeChecker {
28082787 ctx. free_vars ( ) . into_iter ( ) . collect ( )
28092788 }
28102789}
2811-
2812- }
28132790impl Default for TypeChecker {
28142791 fn default ( ) -> Self {
28152792 Self :: new ( )
0 commit comments