Skip to content

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

@zong-zhe

Description

@zong-zhe

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions