@@ -10,7 +10,7 @@ use crate::core::substitute::SubstituteName;
1010use crate :: core:: {
1111 ForallBinder , KindOrType , RowField , RowType , Type , TypeId , normalise, toolkit, unification,
1212} ;
13- use crate :: error:: { ErrorCrumb , ErrorKind } ;
13+ use crate :: error:: ErrorCrumb ;
1414use crate :: source:: { operator, synonym} ;
1515use crate :: state:: CheckState ;
1616use crate :: { ExternalQueries , safe_loop} ;
@@ -394,25 +394,25 @@ where
394394 Type :: Function ( argument_kind, result_kind) => {
395395 let ( argument_type, _) = check_kind ( state, context, argument, argument_kind) ?;
396396
397- let t = context. intern_application ( function_type, argument_type) ;
398- let k = normalise:: normalise ( state, context, result_kind) ?;
397+ let result_type = context. intern_application ( function_type, argument_type) ;
398+ let result_kind = normalise:: normalise ( state, context, result_kind) ?;
399399
400- Ok ( ( t , k ) )
400+ Ok ( ( result_type , result_kind ) )
401401 }
402402
403403 Type :: Unification ( unification_id) => {
404- let argument_u = state. fresh_unification ( context. queries , context. prim . t ) ;
405- let result_u = state. fresh_unification ( context. queries , context. prim . t ) ;
404+ let argument_kind = state. fresh_unification ( context. queries , context. prim . t ) ;
405+ let result_kind = state. fresh_unification ( context. queries , context. prim . t ) ;
406406
407- let function_u = context. intern_function ( argument_u , result_u ) ;
408- unification:: solve ( state, context, function_kind, unification_id, function_u ) ?;
407+ let function = context. intern_function ( argument_kind , result_kind ) ;
408+ unification:: solve ( state, context, function_kind, unification_id, function ) ?;
409409
410- let ( argument_type, _) = check_kind ( state, context, argument, argument_u ) ?;
410+ let ( argument_type, _) = check_kind ( state, context, argument, argument_kind ) ?;
411411
412- let t = context. intern_application ( function_type, argument_type) ;
413- let k = normalise:: normalise ( state, context, result_u ) ?;
412+ let result_type = context. intern_application ( function_type, argument_type) ;
413+ let result_kind = normalise:: normalise ( state, context, result_kind ) ?;
414414
415- Ok ( ( t , k ) )
415+ Ok ( ( result_type , result_kind ) )
416416 }
417417
418418 Type :: Forall ( binder_id, inner_kind) => {
@@ -433,20 +433,18 @@ where
433433 // this ensures that implicit variables are bound.
434434 let ( argument_type, _) = infer_kind ( state, context, argument) ?;
435435
436- let t = context. intern_application ( function_type, argument_type) ;
437- let k = context. unknown ( "cannot apply function type" ) ;
436+ let result_type = context. intern_application ( function_type, argument_type) ;
437+ let result_kind = context. unknown ( "cannot apply function type" ) ;
438438
439- let function_type = state. pretty_id ( context, function_type) ?;
440- let function_kind = state. pretty_id ( context, function_kind) ?;
441- let argument_type = state. pretty_id ( context, argument_type) ?;
442-
443- state. insert_error ( ErrorKind :: InvalidTypeApplication {
439+ toolkit:: report_invalid_type_application (
440+ state,
441+ context,
444442 function_type,
445443 function_kind,
446444 argument_type,
447- } ) ;
445+ ) ? ;
448446
449- Ok ( ( t , k ) )
447+ Ok ( ( result_type , result_kind ) )
450448 }
451449 }
452450}
0 commit comments