diff --git a/src/stan/lang/ast/scope.hpp b/src/stan/lang/ast/scope.hpp index 4878dc88238..82b8afd4ea5 100644 --- a/src/stan/lang/ast/scope.hpp +++ b/src/stan/lang/ast/scope.hpp @@ -66,9 +66,10 @@ namespace stan { bool is_local() const; /** - * Flags local scopes which permit parameter variables, - * i.e., program block can't be transformed data or - * generated quantities program blocks. + * Flags local scopes which permit parameter variables. + * Allows local blocks in functions, transfromed parameter, + * and model blocks; disallows local blocks in transformed data + * and generated quantities program blocks. * * @return true for local parameter origin block types */ diff --git a/src/stan/lang/ast/scope_def.hpp b/src/stan/lang/ast/scope_def.hpp index 0d12da44879..95364cc64b6 100644 --- a/src/stan/lang/ast/scope_def.hpp +++ b/src/stan/lang/ast/scope_def.hpp @@ -26,9 +26,9 @@ namespace stan { } bool scope::local_allows_var() const { - return is_local_ && - !(program_block_ == transformed_data_origin - || program_block_ == derived_origin); + return is_local_ + && program_block_ != transformed_data_origin + && program_block_ != derived_origin; } bool scope::par_or_tpar() const {