aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
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
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')
-rw-r--r--src/vhdl/iirs.ads4
-rw-r--r--src/vhdl/nodes_meta.adb2
-rw-r--r--src/vhdl/sem_expr.adb13
3 files changed, 16 insertions, 3 deletions
diff --git a/src/vhdl/iirs.ads b/src/vhdl/iirs.ads
index b88b35217..4057b6fc0 100644
--- a/src/vhdl/iirs.ads
+++ b/src/vhdl/iirs.ads
@@ -3559,12 +3559,12 @@ package Iirs is
-- type_mark ' ( expression )
-- | type_mark ' aggregate
--
- -- Get/Set_Type (Field1)
- --
-- Get/Set_Type_Mark (Field4)
--
-- Get/Set_Expression (Field5)
--
+ -- Get/Set_Type (Field1)
+ --
-- Get/Set_Expr_Staticness (State1)
-- Iir_Kind_Type_Conversion (Short)
diff --git a/src/vhdl/nodes_meta.adb b/src/vhdl/nodes_meta.adb
index a27da707c..b7a3a7789 100644
--- a/src/vhdl/nodes_meta.adb
+++ b/src/vhdl/nodes_meta.adb
@@ -3617,9 +3617,9 @@ package body Nodes_Meta is
Field_Type,
-- Iir_Kind_Qualified_Expression
Field_Expr_Staticness,
- Field_Type,
Field_Type_Mark,
Field_Expression,
+ Field_Type,
-- Iir_Kind_Type_Conversion
Field_Expr_Staticness,
Field_Type,
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;