@@ -66,6 +66,14 @@ impl<'a> ResolvedFormal<'a> {
66
66
ResolvedFormal :: Converted ( idx, _, _) => idx,
67
67
}
68
68
}
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
+ }
69
77
}
70
78
71
79
impl < ' a > AnalyzeContext < ' a > {
@@ -135,12 +143,19 @@ impl<'a> AnalyzeContext<'a> {
135
143
// The prefix of the name was not found in the formal region
136
144
// it must be a type conversion or a single parameter function call
137
145
138
- let ( idx , pos, formal_ent ) = if let Some ( ( pos , designator ) ) =
146
+ let ( pos, resolved_formal ) = if let Some ( ( inner_pos , inner_name ) ) =
139
147
to_formal_conversion_argument ( & mut fcall. parameters )
140
148
{
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
+ )
144
159
} else {
145
160
return Err ( Diagnostic :: error ( name_pos, "Invalid formal conversion" ) . into ( ) ) ;
146
161
} ;
@@ -152,7 +167,7 @@ impl<'a> AnalyzeContext<'a> {
152
167
diagnostics,
153
168
) ) ? {
154
169
Some ( ResolvedName :: Type ( typ) ) => {
155
- let ctyp = formal_ent . type_mark ( ) . base ( ) ;
170
+ let ctyp = resolved_formal . type_mark ( ) . base ( ) ;
156
171
if !typ. base ( ) . is_closely_related ( ctyp) {
157
172
return Err ( Diagnostic :: error (
158
173
pos,
@@ -171,9 +186,9 @@ impl<'a> AnalyzeContext<'a> {
171
186
172
187
for ent in overloaded. entities ( ) {
173
188
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
+ )
177
192
{
178
193
candidates. push ( ent) ;
179
194
}
@@ -199,7 +214,7 @@ impl<'a> AnalyzeContext<'a> {
199
214
format ! (
200
215
"No function '{}' accepting {}" ,
201
216
fcall. name,
202
- formal_ent . type_mark( ) . describe( )
217
+ resolved_formal . type_mark( ) . describe( )
203
218
) ,
204
219
)
205
220
. into ( ) ) ;
@@ -212,7 +227,11 @@ impl<'a> AnalyzeContext<'a> {
212
227
}
213
228
} ;
214
229
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
+ ) )
216
235
} else if let Some ( mut indexed_name) = fcall. as_indexed ( ) {
217
236
let resolved_prefix = self . resolve_formal (
218
237
formal_region,
@@ -361,7 +380,7 @@ impl<'a> AnalyzeContext<'a> {
361
380
362
381
fn to_formal_conversion_argument (
363
382
parameters : & mut [ AssociationElement ] ,
364
- ) -> Option < ( & SrcPos , & mut WithRef < Designator > ) > {
383
+ ) -> Option < ( & SrcPos , & mut Box < Name > ) > {
365
384
if let & mut [ AssociationElement {
366
385
ref formal,
367
386
ref mut actual,
@@ -370,9 +389,7 @@ fn to_formal_conversion_argument(
370
389
if formal. is_some ( ) {
371
390
return None ;
372
391
} 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) ) ;
376
393
}
377
394
}
378
395
None
0 commit comments