aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/sem_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-11-07 02:38:31 +0100
committerTristan Gingold <tgingold@free.fr>2018-11-07 20:53:22 +0100
commit958d4df37af5dc54f0e9156cbdcc367666538067 (patch)
treea012392082ba2a6372da5176b88302079625f98e /src/vhdl/sem_expr.adb
parent225bfee0942234a194d1a147b374bf6250c99e8c (diff)
downloadghdl-958d4df37af5dc54f0e9156cbdcc367666538067.tar.gz
ghdl-958d4df37af5dc54f0e9156cbdcc367666538067.tar.bz2
ghdl-958d4df37af5dc54f0e9156cbdcc367666538067.zip
Forward type of expression in qualified expression.
Fix a regression.
Diffstat (limited to 'src/vhdl/sem_expr.adb')
-rw-r--r--src/vhdl/sem_expr.adb13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index a33212839..707b65f68 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -4078,6 +4078,19 @@ package body Sem_Expr is
-- static expression with a non-locally static subtype.
Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Res),
Get_Type_Staticness (N_Type)));
+
+ -- When possible, use the type of the expression as the type of the
+ -- qualified expression.
+ -- TODO: also handle unbounded subtypes, but only if this is a proper
+ -- subtype.
+ case Get_Kind (N_Type) is
+ when Iir_Kind_Array_Type_Definition
+ | Iir_Kind_Record_Type_Definition =>
+ Set_Type (Expr, Get_Type (Res));
+ when others =>
+ null;
+ end case;
+
return Expr;
end Sem_Qualified_Expression;