@@ -238,7 +238,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
238238 expr. pos ( self . ctx ) ,
239239 "Ambiguous expression. You can use a qualified expression type'(expr) to disambiguate." ,
240240 ErrorCode :: AmbiguousExpression ,
241- ) ;
241+ ) ;
242242 Err ( EvalError :: Unknown )
243243 }
244244 }
@@ -254,7 +254,8 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
254254 ) -> EvalResult < Vec < OverloadedEnt < ' a > > > {
255255 let designator = Designator :: OperatorSymbol ( op) ;
256256 match scope
257- . lookup ( self . ctx , op_pos, & designator)
257+ . lookup ( & designator)
258+ . map_err ( |err| err. into_diagnostic ( self . ctx , op_pos) )
258259 . into_eval_result ( diagnostics) ?
259260 {
260261 NamedEntities :: Single ( ent) => {
@@ -503,7 +504,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
503504 Literal :: String ( _) => Ok ( ExpressionType :: String ) ,
504505 Literal :: BitString ( _) => Ok ( ExpressionType :: String ) ,
505506 Literal :: Character ( chr) => {
506- match scope. lookup ( self . ctx , span , & Designator :: Character ( * chr) ) {
507+ match scope. lookup ( & Designator :: Character ( * chr) ) {
507508 Ok ( NamedEntities :: Single ( ent) ) => {
508509 // Should never happen but better know if it does
509510 diagnostics. add (
@@ -543,7 +544,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
543544 }
544545 }
545546 Err ( e) => {
546- diagnostics. push ( e) ;
547+ diagnostics. push ( e. into_diagnostic ( self . ctx , span ) ) ;
547548 Err ( EvalError :: Unknown )
548549 }
549550 }
@@ -624,12 +625,10 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
624625 self . expr_pos_with_ttyp ( scope, target_type, expr. span , & mut expr. item , diagnostics)
625626 }
626627
627- fn implicit_bool_types ( & self , scope : & Scope < ' a > , span : TokenSpan ) -> FnvHashSet < BaseType < ' a > > {
628- if let Ok ( NamedEntities :: Overloaded ( overloaded) ) = scope. lookup (
629- self . ctx ,
630- span,
631- & Designator :: OperatorSymbol ( Operator :: QueQue ) ,
632- ) {
628+ fn implicit_bool_types ( & self , scope : & Scope < ' a > ) -> FnvHashSet < BaseType < ' a > > {
629+ if let Ok ( NamedEntities :: Overloaded ( overloaded) ) =
630+ scope. lookup ( & Designator :: OperatorSymbol ( Operator :: QueQue ) )
631+ {
633632 overloaded
634633 . entities ( )
635634 . filter_map ( |ent| ent. formals ( ) . nth ( 0 ) . map ( |typ| typ. type_mark ( ) . base ( ) ) )
@@ -650,7 +649,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
650649 match types {
651650 ExpressionType :: Unambiguous ( typ) => {
652651 if typ. base ( ) != self . boolean ( ) . base ( ) {
653- let implicit_bools = self . implicit_bool_types ( scope, expr . span ) ;
652+ let implicit_bools = self . implicit_bool_types ( scope) ;
654653 if !implicit_bools. contains ( & typ. base ( ) ) {
655654 diagnostics. add (
656655 expr. pos ( self . ctx ) ,
@@ -659,7 +658,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
659658 typ. describe( ) ,
660659 self . boolean( ) . describe( )
661660 ) ,
662- ErrorCode :: NoImplicitConversion
661+ ErrorCode :: NoImplicitConversion ,
663662 ) ;
664663 }
665664 }
@@ -669,7 +668,7 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
669668 self . expr_with_ttyp ( scope, self . boolean ( ) , expr, diagnostics) ?;
670669 } else {
671670 let implicit_bool_types: FnvHashSet < _ > = self
672- . implicit_bool_types ( scope, expr . span )
671+ . implicit_bool_types ( scope)
673672 . intersection ( & types)
674673 . cloned ( )
675674 . collect ( ) ;
@@ -1012,18 +1011,18 @@ impl<'a, 't> AnalyzeContext<'a, 't> {
10121011 Diagnostic :: new (
10131012 choice. pos ( self . ctx ) ,
10141013 format ! (
1015- "All elements of record '{}' are already associated" ,
1016- record_type. designator( )
1017- ) ,
1014+ "All elements of record '{}' are already associated" ,
1015+ record_type. designator( )
1016+ ) ,
10181017 ErrorCode :: AlreadyAssociated ,
10191018 )
1020- . opt_related (
1021- record_type. decl_pos ( ) ,
1022- format ! (
1023- "Record '{}' defined here" ,
1024- record_type. designator( )
1019+ . opt_related (
1020+ record_type. decl_pos ( ) ,
1021+ format ! (
1022+ "Record '{}' defined here" ,
1023+ record_type. designator( )
1024+ ) ,
10251025 ) ,
1026- ) ,
10271026 )
10281027 }
10291028
0 commit comments