Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The variable scope issue (KCL_FAST_EVAL=1) bug evaluator #1454

Closed
bozaro opened this issue Jun 28, 2024 · 2 comments · Fixed by #1456
Closed

[Bug] The variable scope issue (KCL_FAST_EVAL=1) bug evaluator #1454

bozaro opened this issue Jun 28, 2024 · 2 comments · Fixed by #1456

Comments

@bozaro
Copy link
Contributor

bozaro commented Jun 28, 2024

Bug Report

1. Minimal reproduce step (Required)

Run configuration with KCL_FAST_EVAL=1 (KCL_FAST_EVAL=1 kclvm_cli run .)

schema User:
    id: str

schema Users:
    [str]: User

schema DB:
    users: Users = {}

    check:
        all user in users {
            user == users[user].id
        }

schema DBs:
    [str]: DB

dbs_user: DBs = {
    user = DB {
        users = {
            app = User {id = "app"}
        }
    }
}
db_user = dbs_user.user

2. What did you expect to see? (Required)

Same result as without KCL_FAST_EVAL=1:

dbs_user:
  user:
    users:
      app:
        id: app
db_user:
  users:
    app:
      id: app

3. What did you see instead (Required)

error[E3M38]: EvaluationError
  --> /home/bozaro/joom/config-state/kcl/data/mongodb/joomproduction/user.k:25:1
   |
25 | db_user = dbs_user.user
   |  schema 'DBs' attribute 'user' not found
   |

4. What is your KCL components version? (Required)

➜  kclvm_cli version
Version: 0.9.0-c020ab3eb4b9179219d6837a57f5d323
Platform: x86_64-unknown-linux-gnu
GitCommit: 11dffcb46314f5cf326b7aec6c30c1889f3d29ac
@bozaro bozaro changed the title The variable visibility issue (KCL_FAST_EVAL=1) bug evaluator [Bug] The variable visibility issue (KCL_FAST_EVAL=1) bug evaluator Jun 28, 2024
@bozaro bozaro changed the title [Bug] The variable visibility issue (KCL_FAST_EVAL=1) bug evaluator [Bug] The variable scope issue (KCL_FAST_EVAL=1) bug evaluator Jun 28, 2024
@bozaro
Copy link
Contributor Author

bozaro commented Jun 28, 2024

There are internally some user variable name collision between lines:

  • all user in users {
  • user = DB {

@Peefy
Copy link
Contributor

Peefy commented Jun 28, 2024

Thanks for the feedback and fixed in #1456

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants