-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSSStyleVariable APIs allow setting values of the wrong type #2763
Comments
Digging a bit more, it seems this is because CSSStyleVariable's class declaration uses class CSSStyleVariable<out TValue : StylePropertyValue>(override val name: String) : CSSVariable and the call for invoking a variable has the following API: operator fun <TValue : StylePropertyValue> CSSStyleVariable<TValue>.invoke(value: TValue) { ... } so it seems like what is happening is the compiler sees the line |
Now I'm wondering why What would happen if you took the class CSSStyleVariable<T : StylePropertyValue>(override val name: String) : CSSVariable |
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
Simple example code to demonstrate the problem (here, setting a
LineStyle
variable with aDisplayStyle
value):Expected: The line
unexpectedVariableAssignment(DisplayStyle.Flex)
should not compileActual: The code compiles and runs fine.
The text was updated successfully, but these errors were encountered: