You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kipper currently does not support any form of implicit type narrowing as the language has until now primarily operated with primitives and only with v0.12.0 has added support for objects, classes and interfaces. To properly support such structures though advanced type mechanisms will be required that allow the user to easily narrow down the type of a dynamic value.
While the obj2 was obviously typed checked and was narrowed down to Sample in the given branch, the compiler has no register for the scope of the if-statement indicating that the type has been altered in any way meaning it throws an error regardless of the type check operation done beforehand.
To fix this the compiler will need a specific type register where narrowed and implicitly cast types should be stored allowing the user to refer to any value in any given branch branch with the correct type.
Exact behaviour / changes you want
Implement type register for if-statement and conditional expression branches allowing types to be used in their appropriately narrowed form.
Add advanced type evaluation where references are cross-checked with any given register to ensure that the type being used is the correct type.
Is there an existing proposal for this?
This feature does not exist in the latest version
Proposal
Kipper currently does not support any form of implicit type narrowing as the language has until now primarily operated with primitives and only with
v0.12.0
has added support for objects, classes and interfaces. To properly support such structures though advanced type mechanisms will be required that allow the user to easily narrow down the type of a dynamic value.For example, using a
matches
expression:While the
obj2
was obviously typed checked and was narrowed down toSample
in the given branch, the compiler has no register for the scope of the if-statement indicating that the type has been altered in any way meaning it throws an error regardless of the type check operation done beforehand.To fix this the compiler will need a specific type register where narrowed and implicitly cast types should be stored allowing the user to refer to any value in any given branch branch with the correct type.
Exact behaviour / changes you want
Related issues
T1 | T2 | T3 ... Tn
#496T1 & T2 & T3 ... Tn
#706in
expression which checks if a given key exists in the provided type #707The text was updated successfully, but these errors were encountered: