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 scope of the attribute inside the schema is incorrect #1769

Open
zong-zhe opened this issue Dec 2, 2024 · 0 comments
Open

Bug: The scope of the attribute inside the schema is incorrect #1769

zong-zhe opened this issue Dec 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@zong-zhe
Copy link
Contributor

zong-zhe commented Dec 2, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

The main.k:

schema Fold:
    l: [any]
    acc: any
    func: (any, any) -> any
    value: any = acc if len(l) == 0 else Fold {
        # `l` has been replaced by `l[1::]`. When the size of `l` is 1, the next line should raise an error
        l: l[1::] 
        # the `l` has been replaced in the previous line, when the size of `l` is 1, error here !
        acc: func(acc, l[0])
        func: func
    }.value

flod = Fold {
    l: [1, 2, 3, 4, 5],
    acc: 0,
    func: lambda x, y { x + y }
}.value

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

An error raised.

3. What did you see instead (Required)

No errors, and an result got:

flod: 15

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

The main branch of KCL

@zong-zhe zong-zhe added the bug Something isn't working label Dec 2, 2024
@zong-zhe zong-zhe added this to the v0.11.0 Release milestone Dec 2, 2024
@zong-zhe zong-zhe added this to KCL 2024 Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant