File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -2683,3 +2683,32 @@ p:
26832683fullName: Alice White
26842684` ` `
26852685
2686+ # # 67. Does the use of mixed-in attributes outisde of mixin requires casting to `any` type ?
2687+
2688+ You need to add specifically the type into the schema. An example code shown below :
2689+
2690+ ` ` ` KCL
2691+ schema FooBar:
2692+ mixin [
2693+ FooBarMixin
2694+ ]
2695+ foo: str = 'foo'
2696+ bar: str = 'bar'
2697+
2698+ protocol FooBarProtocol:
2699+ foo: str
2700+ bar: str
2701+
2702+ mixin FooBarMixin for FooBarProtocol:
2703+ foobar: str = "${foo}.${bar}" # Attribute with the annotation can be accessed outside the schema.
2704+
2705+ _c = FooBar {}
2706+ foobar = _c.foobar
2707+ ` ` `
2708+
2709+ returns the output :
2710+
2711+ ` ` ` bash
2712+ foobar: foo.bar
2713+ ` ` `
2714+
You can’t perform that action at this time.
0 commit comments