diff --git a/integration_tests/types_test.ucg b/integration_tests/types_test.ucg index 2423f78..2fe650a 100644 --- a/integration_tests/types_test.ucg +++ b/integration_tests/types_test.ucg @@ -60,4 +60,11 @@ assert t.ok{ assert t.not_ok{ test = foo_check({bar="foo"}), desc = "we can check for absent foo string fields", +}; + +let test_for_field = func(name, tpl) => (name) in tpl; + +assert t.ok{ + test = test_for_field("name", {name="foo"}), + desc = "bareword collisions with field names still works for `in` operator", }; \ No newline at end of file diff --git a/src/build/mod.rs b/src/build/mod.rs index f1368d0..e465f2d 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -852,7 +852,10 @@ impl<'a> FileBuilder<'a> { scope.lookup_idx(right.pos(), &Val::Int(i.val)) } _ => { - let val = self.eval_expr(right, &scope)?; + // We need to clear any curr_vals for the eval so we don't include them + // in the scope for dot lookups. + let eval_scope = scope.spawn_child(); + let val = self.eval_expr(right, &eval_scope)?; match val.as_ref() { Val::Int(i) => scope.lookup_idx(right.pos(), &Val::Int(*i)), Val::Str(ref s) => scope