Only nullify tasty if Yflexify-tasty is set; Refine FlexibleType nullification rules#23938
Only nullify tasty if Yflexify-tasty is set; Refine FlexibleType nullification rules#23938noti0na1 merged 11 commits intoscala:mainfrom
Yflexify-tasty is set; Refine FlexibleType nullification rules#23938Conversation
| parent2 match | ||
| case FlexibleType(_, parent2a) if ctx.flexibleTypes => | ||
| FlexibleType(derivedRefinedType(tp, parent2a, refinedInfo2)) | ||
| case OrNull(parent2a) => | ||
| OrNull(derivedRefinedType(tp, parent2a, refinedInfo2)) | ||
| case _ => | ||
| derivedRefinedType(tp, parent2, refinedInfo2) |
There was a problem hiding this comment.
We can try it.
I'm a bit nervous about flexifying the parent type and then undoing that (what if it was previously flexified already?), but we can try it.
A simpler approach would be to always flexify the refined type at the top level but then to not flexify the parent type. That may unnecessarily flexify a refined type in cases when the parent is one of the types that we don't flexify (such as a primitive type), but it seems unlikely that people would want to refine such types.
I think it doesn't make sense to flexify the parent type because it doesn't make sense to refine null. You wouldn't say (Foo|null) { def bar(): Int }. Instead, you could say (Foo { def bar(): Int }) | Null.
|
I have run the compilation tests locally. The tests below fail because of the current awkward stage of stdlib. |
4b00c5c to
299a72a
Compare
|
It seems to be fixing 13 projects in the OpenCB, however some of reported projects are now failing with different errors requring wrong number of arguments - I have not seen errors like that before.
Error: 166 | check(genTuple(Gen.int, Gen.int.filter(_ != 0))) { (num, div) =>
Error: | ^
Error: | Wrong number of parameters, expected: 1
Error: 167 | val eff = zArrow(num).provide(ZLayer.succeed(div))
Error: 168 | assertZIO(eff)(equalTo(num / div))
Error: |
Error: -- [E086] Syntax Error: /build/repo/ordset/src/ordset/util/ShowUtil.scala:62:67
Error: 62 | val indentedLines = lines.zipWithIndex.map { (line, index) =>
Error: | ^
Error: | Wrong number of parameters, expected: 1
Error: 63 | if (index == 0) line else fieldIndent + line
Error: |
Error: | longer explanation available when compiling with `-explain`
Error: -- [E046] Cyclic Error: /build/repo/facsimile-util/src/test/scala/org/facsim/util/test/MemoizeTest.scala:224:17
Error: 224 | forAll { (il: List[Int]) =>
Error: | ^
Error: | Cyclic reference involving trait BitSet
Error: |
Error: | Run with -explain-cyclic for more details.
Error: |
Error: -- [E007] Type Mismatch Error: /build/repo/univeq/shared/src/main/scala-3/japgolly/univeq/internal/Derivation.scala:78:61
Error: 78 | log(" - Checking: " + Type.show(using fUnit.asType))
Error: | ^^^^^^^^^^^^
Error: | Found: (scala.quoted.Type[? <: AnyKind])?
Error: | Required: scala.quoted.Type[T]
Error: |
Error: | where: T is a type variable with constraint <: AnyKind
Error: |
Error: | longer explanation available when compiling with `-explain` |
|
I would guess that the errors about wrong number of arguments are due to some failure of auto-tupling probably getting confused by flexible types. |
Ynullify-tasty is set; Refine FlexibleType nullification rules
|
I will merge this after the CI passes. |
Ynullify-tasty is set; Refine FlexibleType nullification rulesYflexify-tasty is set; Refine FlexibleType nullification rules
Given the nightly results, we think the nullification rules still need some polish and is not ready for all compiled Scala code. Hence, we only nullify tasty if
Ynullify-tastyis set now.Based on #23911
Fixes #23908
Could fix #23933, #23935, #23936, and #23937 (I tested locally due the explicit nulls tests disabled temprarily)