Skip to content

Duplicate List Items When Using Schema, Mixin, and Protocol Together #1772

Open
@eminaktas

Description

@eminaktas

Bug Report

1. Minimal reproduce step (Required)

An example in the playground here.

schema Tree:
  names?: [str] = []

schema NotAPerson[tree: Tree]:
    mixin [TreeNamesMixin]

    configs: Configs {
      tree = tree
    }

    names = configs.tree.names

schema TreeNamesMixin for TreeProtocol:
    configs.tree.names += ["Banyan", "Alder", "Cedar"]

protocol TreeProtocol:
  configs: Configs

schema Configs:
  tree: Tree

_treeConfig = Tree {}

result = NotAPerson(_treeConfig)

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

result:
  configs:
    tree:
      names:
      - Banyan
      - Alder
      - Cedar
  names:
  - Banyan
  - Alder
  - Cedar

3. What did you see instead (Required)

result:
  configs:
    tree:
      names:
      - Banyan
      - Alder
      - Cedar
      - Banyan
      - Alder
      - Cedar
  names:
  - Banyan
  - Alder
  - Cedar

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

0.10.10-darwin-arm64

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions