From 67890d248c62a874f11145d489efda8edf5dcc8b Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 28 Sep 2016 03:34:51 +0200 Subject: Set type of range expression from the type mark (if present). Fix issue #156 --- src/vhdl/sem_expr.adb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 902162d12..027ed5e20 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -664,11 +664,14 @@ package body Sem_Expr is Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Left), Get_Expr_Staticness (Right))); - if A_Type /= Null_Iir - and then Are_Types_Compatible (Expr_Type, A_Type) = Not_Compatible - then - Error_Msg_Sem (+Expr, "type of range doesn't match expected type"); - return Null_Iir; + if A_Type /= Null_Iir then + if Are_Types_Compatible (Expr_Type, A_Type) = Not_Compatible then + Error_Msg_Sem (+Expr, "type of range doesn't match expected type"); + return Null_Iir; + end if; + + -- Use A_TYPE for the type of the expression. + Expr_Type := A_Type; end if; Set_Type (Expr, Expr_Type); -- cgit v1.2.3