about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-30 00:19:11 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-12-15 10:20:41 -0800
commite167fdf43cedea8b96690246734d652643fe1bd1 (patch)
tree35ef18544ec7b5fd04dcc2ef6326d36d5fe2114b
parent5076d9636b258c7f9d2485b9d19738b3602d8d9c (diff)
downloadmu-e167fdf43cedea8b96690246734d652643fe1bd1.tar.gz
bugfix after commit 2612
-rw-r--r--060immutable.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/060immutable.cc b/060immutable.cc
index 96e999dc..f57d7c23 100644
--- a/060immutable.cc
+++ b/060immutable.cc
@@ -31,6 +31,26 @@ recipe foo p:address:point -> p:address:point [
 ]
 $warn: 0
 
+:(scenario ignore_literal_ingredients_for_immutability_checks)
+% Hide_warnings = true;
+recipe main [
+  local-scope
+  p:address:d1 <- new d1:type
+  q:number <- foo p
+]
+recipe foo p:address:d1 -> q:number [
+  local-scope
+  load-ingredients
+  x:address:d1 <- new d1:type
+  y:address:number <- get-address *x, p:offset  # ignore this 'p'
+  q <- copy 34
+]
+container d1 [
+  p:number
+  q:number
+]
+$warn: 0
+
 :(scenario cannot_take_address_inside_immutable_ingredients)
 % Hide_warnings = true;
 recipe main [
@@ -246,6 +266,7 @@ bool is_present_in_ingredients(const recipe& callee, const string& ingredient_na
 set<long long int> ingredient_indices(const instruction& inst, const set<string>& ingredient_names) {
   set<long long int> result;
   for (long long int i = 0; i < SIZE(inst.ingredients); ++i) {
+    if (is_literal(inst.ingredients.at(i))) continue;
     if (ingredient_names.find(inst.ingredients.at(i).name) != ingredient_names.end())
       result.insert(i);
   }