From aeffc4a00e82f22350ca1e0d94b6556f2b78f928 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Fri, 1 Feb 2019 15:53:10 +0100
Subject: [PATCH] Added semantic error for unsupported lazy/fuzzy altstep
 parameters in 'activate' (bug 537979)

Change-Id: I3a6f012477d09856b97f78c6712c424e6d5c31e3
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 compiler2/ttcn3/AST_ttcn3.cc | 22 +++++++++++++++++++++-
 compiler2/ttcn3/AST_ttcn3.hh |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc
index 52f5f6cdc..f4dae1e76 100644
--- a/compiler2/ttcn3/AST_ttcn3.cc
+++ b/compiler2/ttcn3/AST_ttcn3.cc
@@ -9914,8 +9914,12 @@ namespace Ttcn {
     bool ret_val = true;
     for(size_t i = 0; i < p_aplist->get_nof_pars(); i++) {
       ActualPar *t_ap = p_aplist->get_par(i);
-      if(t_ap->get_selection() != ActualPar::AP_REF) continue;
       FormalPar *t_fp = pars_v[i];
+      if (t_fp->get_eval_type() != NORMAL_EVAL) {
+        t_ap->get_location()->error("Activating a default altstep with @lazy or "
+          "@fuzzy parameters is not supported");
+      }
+      if(t_ap->get_selection() != ActualPar::AP_REF) continue;
       switch(t_fp->get_asstype()) {
       case Common::Assignment::A_PAR_VAL_OUT:
       case Common::Assignment::A_PAR_VAL_INOUT:
@@ -10632,6 +10636,22 @@ namespace Ttcn {
       DEBUG(level, "actual parameter: erroneous");
     }
   }
+  
+  Location* ActualPar::get_location() const
+  {
+    switch (selection) {
+    case AP_VALUE:
+      return val;
+    case AP_TEMPLATE:
+      return temp;
+    case AP_REF:
+      return ref;
+    case AP_DEFAULT:
+      return act->get_location();
+    default:
+      FATAL_ERROR("ActualPar::get_location()");
+    }
+  }
 
   // =================================
   // ===== ActualParList
diff --git a/compiler2/ttcn3/AST_ttcn3.hh b/compiler2/ttcn3/AST_ttcn3.hh
index d956131ca..602ad6fb3 100644
--- a/compiler2/ttcn3/AST_ttcn3.hh
+++ b/compiler2/ttcn3/AST_ttcn3.hh
@@ -146,6 +146,7 @@ namespace Ttcn {
     void set_gen_post_restriction_check(
       template_restriction_t p_gen_post_restriction_check)
       { gen_post_restriction_check = p_gen_post_restriction_check; }
+    Location* get_location() const;
   };
 
   /// A collection of actual parameters (parameter list)
-- 
GitLab