File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -1125,6 +1125,8 @@ impl<'a> AnalyzeContext<'a> {
11251125 }
11261126 }
11271127 Disambiguated :: Unambiguous ( ent) => {
1128+ prefix. set_unique_reference ( & ent) ;
1129+
11281130 if let Some ( typ) = ent. return_type ( ) {
11291131 resolved =
11301132 ResolvedName :: Expression ( DisambiguatedType :: Unambiguous ( typ) ) ;
Original file line number Diff line number Diff line change @@ -2033,3 +2033,35 @@ end architecture;
20332033 ) ;
20342034 }
20352035}
2036+
2037+ /// This is a regression test for github issue #229
2038+ /// The reference was not set on the subprogram name when selected
2039+ #[ test]
2040+ fn sets_reference_on_selected_subprogram_call ( ) {
2041+ let mut builder = LibraryBuilder :: new ( ) ;
2042+ builder. code (
2043+ "libname" ,
2044+ "
2045+ entity ent is
2046+ end entity;
2047+
2048+ architecture a of ent is
2049+ type my_record_t is record
2050+ field1 : natural;
2051+ end record my_record_t;
2052+
2053+ function my_function return my_record_t is
2054+ begin
2055+ return (others => 0);
2056+ end function;
2057+
2058+ constant CONST1 : natural := my_function.field1;
2059+ begin
2060+ end architecture;
2061+ " ,
2062+ ) ;
2063+
2064+ let ( root, diagnostics) = builder. get_analyzed_root ( ) ;
2065+ check_no_diagnostics ( & diagnostics) ;
2066+ assert_eq ! ( root. find_all_unresolved( ) . 1 , vec![ ] ) ;
2067+ }
You can’t perform that action at this time.
0 commit comments