File tree Expand file tree Collapse file tree 1 file changed +27
-6
lines changed Expand file tree Collapse file tree 1 file changed +27
-6
lines changed Original file line number Diff line number Diff line change @@ -84,12 +84,33 @@ impl<'a> AnalyzeContext<'a> {
8484 match name. as_mut ( ) {
8585 // Could be an array constraint such as integer_vector(0 to 3)
8686 // @TODO we ignore the suffix for now
87- Name :: Slice ( prefix, _) => self . type_name (
88- scope,
89- & prefix. pos ,
90- & mut prefix. item ,
91- diagnostics,
92- ) ?,
87+ Name :: Slice ( prefix, drange) => {
88+ let typ = self . type_name (
89+ scope,
90+ & prefix. pos ,
91+ & mut prefix. item ,
92+ diagnostics,
93+ ) ?;
94+ if let Type :: Array { indexes, .. } = typ. base ( ) . kind ( ) {
95+ if let Some ( Some ( idx_typ) ) = indexes. get ( 0 ) {
96+ self . drange_with_ttyp (
97+ scope,
98+ ( * idx_typ) . into ( ) ,
99+ drange,
100+ diagnostics,
101+ ) ?;
102+ }
103+ } else {
104+ diagnostics. error (
105+ & assoc. actual . pos ,
106+ format ! (
107+ "Array constraint cannot be used for {}" ,
108+ typ. describe( )
109+ ) ,
110+ ) ;
111+ }
112+ typ
113+ }
93114 // Could be a record constraint such as rec_t(field(0 to 3))
94115 // @TODO we ignore the suffix for now
95116 Name :: CallOrIndexed ( call) if call. could_be_indexed_name ( ) => self
You can’t perform that action at this time.
0 commit comments