Skip to content

Child schema arguments type mixed with parent schema arguments type #1915

Open
@diefans

Description

@diefans

Bug Report

It is not clear from the documentation https://www.kcl-lang.io/docs/reference/lang/spec/schema#schema-definition how schema arguments are dealing with inheritance - IMHO the definition from the child schema should overwrite the parent definition - nothing else makes sense...

1. Minimal reproduce step (Required)

schema Parent[value: str]:

schema Child[value: bool, extra: str](Parent):

child = Child(True, "extra")

If I instantiate Childwithout extra, kcl complains about the missing extra argument - so I guess Child signature is recognized, but the first arguments type is somehow "taken" from Parent...

  |
5 | child = Child(True)
  |         ^ expected 2 positional arguments, found 1
  |

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

no error

3. What did you see instead (Required)

EvaluationError
 --> /home/olli/code/bm/p14n/kcl-test/kcl-typeof-as.k:5:1
  |
5 | child = Child(True, "extra")
  |  expect str, got bool
  |

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

kcl version v0.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions