@@ -66,6 +66,14 @@ impl<'a> ResolvedFormal<'a> {
6666 ResolvedFormal :: Converted ( idx, _, _) => idx,
6767 }
6868 }
69+
70+ fn formal ( & self ) -> InterfaceEnt < ' a > {
71+ * match self {
72+ ResolvedFormal :: Basic ( _, ent) => ent,
73+ ResolvedFormal :: Selected ( _, ent, _) => ent,
74+ ResolvedFormal :: Converted ( _, ent, _) => ent,
75+ }
76+ }
6977}
7078
7179impl < ' a > AnalyzeContext < ' a > {
@@ -135,12 +143,19 @@ impl<'a> AnalyzeContext<'a> {
135143 // The prefix of the name was not found in the formal region
136144 // it must be a type conversion or a single parameter function call
137145
138- let ( idx , pos, formal_ent ) = if let Some ( ( pos , designator ) ) =
146+ let ( pos, resolved_formal ) = if let Some ( ( inner_pos , inner_name ) ) =
139147 to_formal_conversion_argument ( & mut fcall. parameters )
140148 {
141- let ( idx, ent) = formal_region. lookup ( name_pos, designator. designator ( ) ) ?;
142- designator. set_unique_reference ( ent. inner ( ) ) ;
143- ( idx, pos, ent)
149+ (
150+ inner_pos,
151+ self . resolve_formal (
152+ formal_region,
153+ scope,
154+ inner_pos,
155+ inner_name,
156+ diagnostics,
157+ ) ?,
158+ )
144159 } else {
145160 return Err ( Diagnostic :: error ( name_pos, "Invalid formal conversion" ) . into ( ) ) ;
146161 } ;
@@ -152,7 +167,7 @@ impl<'a> AnalyzeContext<'a> {
152167 diagnostics,
153168 ) ) ? {
154169 Some ( ResolvedName :: Type ( typ) ) => {
155- let ctyp = formal_ent . type_mark ( ) . base ( ) ;
170+ let ctyp = resolved_formal . type_mark ( ) . base ( ) ;
156171 if !typ. base ( ) . is_closely_related ( ctyp) {
157172 return Err ( Diagnostic :: error (
158173 pos,
@@ -171,9 +186,9 @@ impl<'a> AnalyzeContext<'a> {
171186
172187 for ent in overloaded. entities ( ) {
173188 if ent. is_function ( )
174- && ent
175- . signature ( )
176- . can_be_called_with_single_parameter ( formal_ent . type_mark ( ) )
189+ && ent. signature ( ) . can_be_called_with_single_parameter (
190+ resolved_formal . type_mark ( ) ,
191+ )
177192 {
178193 candidates. push ( ent) ;
179194 }
@@ -199,7 +214,7 @@ impl<'a> AnalyzeContext<'a> {
199214 format ! (
200215 "No function '{}' accepting {}" ,
201216 fcall. name,
202- formal_ent . type_mark( ) . describe( )
217+ resolved_formal . type_mark( ) . describe( )
203218 ) ,
204219 )
205220 . into ( ) ) ;
@@ -212,7 +227,11 @@ impl<'a> AnalyzeContext<'a> {
212227 }
213228 } ;
214229
215- Ok ( ResolvedFormal :: Converted ( idx, formal_ent, converted_typ) )
230+ Ok ( ResolvedFormal :: Converted (
231+ resolved_formal. idx ( ) ,
232+ resolved_formal. formal ( ) ,
233+ converted_typ,
234+ ) )
216235 } else if let Some ( mut indexed_name) = fcall. as_indexed ( ) {
217236 let resolved_prefix = self . resolve_formal (
218237 formal_region,
@@ -361,7 +380,7 @@ impl<'a> AnalyzeContext<'a> {
361380
362381fn to_formal_conversion_argument (
363382 parameters : & mut [ AssociationElement ] ,
364- ) -> Option < ( & SrcPos , & mut WithRef < Designator > ) > {
383+ ) -> Option < ( & SrcPos , & mut Box < Name > ) > {
365384 if let & mut [ AssociationElement {
366385 ref formal,
367386 ref mut actual,
@@ -370,9 +389,7 @@ fn to_formal_conversion_argument(
370389 if formal. is_some ( ) {
371390 return None ;
372391 } else if let ActualPart :: Expression ( Expression :: Name ( ref mut actual_name) ) = actual. item {
373- if let Name :: Designator ( designator) = actual_name. as_mut ( ) {
374- return Some ( ( & actual. pos , designator) ) ;
375- }
392+ return Some ( ( & actual. pos , actual_name) ) ;
376393 }
377394 }
378395 None
0 commit comments