File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,32 @@ impl<'a> AnalyzeContext<'a> {
200
200
None => { }
201
201
}
202
202
}
203
+ ResolvedName :: Final ( ent) => {
204
+ if let AnyEntKind :: Component ( region) = ent. kind ( ) {
205
+ name. set_unique_reference ( ent) ;
206
+ let ( generic_region, port_region) = region. to_entity_formal ( ) ;
207
+ self . analyze_assoc_elems_with_formal_region (
208
+ & fcall. item . name . pos ,
209
+ & generic_region,
210
+ scope,
211
+ & mut [ ] ,
212
+ diagnostics,
213
+ ) ?;
214
+ self . analyze_assoc_elems_with_formal_region (
215
+ & fcall. item . name . pos ,
216
+ & port_region,
217
+ scope,
218
+ & mut [ ] ,
219
+ diagnostics,
220
+ ) ?;
221
+ } else {
222
+ diagnostics. push ( Diagnostic :: error (
223
+ & name. pos ,
224
+ format ! ( "{} is not a procedure" , resolved. describe_type( ) ) ,
225
+ ) ) ;
226
+ self . analyze_assoc_elems ( scope, parameters, diagnostics) ?;
227
+ }
228
+ }
203
229
resolved => {
204
230
diagnostics. push ( Diagnostic :: error (
205
231
& name. pos ,
Original file line number Diff line number Diff line change @@ -502,3 +502,33 @@ end architecture;
502
502
) ] ,
503
503
) ;
504
504
}
505
+
506
+ #[ test]
507
+ fn empty_component_instantiation ( ) {
508
+ let mut builder = LibraryBuilder :: new ( ) ;
509
+ let code = builder. code (
510
+ "libname" ,
511
+ "
512
+ entity ent is
513
+ end entity;
514
+
515
+ architecture a of ent is
516
+ component empty
517
+ end component;
518
+ begin
519
+ inst: empty;
520
+ end architecture;
521
+
522
+
523
+ " ,
524
+ ) ;
525
+
526
+ let ( root, diagnostics) = builder. get_analyzed_root ( ) ;
527
+ check_no_diagnostics ( & diagnostics) ;
528
+ assert_eq ! (
529
+ root. search_reference( code. source( ) , code. sa( "inst: " , "empty" ) . start( ) )
530
+ . unwrap( )
531
+ . decl_pos( ) ,
532
+ Some ( & code. s1( "empty" ) . pos( ) )
533
+ ) ;
534
+ }
You can’t perform that action at this time.
0 commit comments