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
Add experimental flexible types feature on top of explicit nulls
Enabled by -Yflexible-types with -Yexplicit-nulls.
A flexible type T! is a non-denotable type such that T <: T! <: T|Null and T|Null <: T! <: T. Here we patch return types and parameter types of Java methods and fields to use flexible types.
This is unsound and kills subtyping transitivity but makes interop with Java play more nicely with the explicit nulls experimental feature (i.e. fewer nullability casts).
Co-authored-by: Ondřej Lhoták <[email protected]>
Co-authored-by: Evan Girardin <[email protected]>
valYexplicitNulls:Setting[Boolean] =BooleanSetting("-Yexplicit-nulls", "Make reference types non-nullable. Nullable types can be expressed with unions: e.g. String|Null.")
413
+
valYflexibleTypes:Setting[Boolean] =BooleanSetting("-Yflexible-types", "Make Java return types and parameter types use flexible types, which have a nullable lower bound and non-null upper bound.")
413
414
valYcheckInit:Setting[Boolean] =BooleanSetting("-Ysafe-init", "Ensure safe initialization of objects.")
414
415
valYcheckInitGlobal:Setting[Boolean] =BooleanSetting("-Ysafe-init-global", "Check safe initialization of global objects.")
415
416
valYrequireTargetName:Setting[Boolean] =BooleanSetting("-Yrequire-targetName", "Warn if an operator is defined without a @targetName annotation.")
0 commit comments