Skip to content

Commit 0bcff78

Browse files
smarterKordyjan
authored andcommitted
Add FIXMEs regarding TypeVar#resetInst breaking our caching logic
I'm afraid we'll have to get rid of it if we want our caches to be correct, but I don't have the time to look into it right now. [Cherry-picked 7de3663]
1 parent b8e876c commit 0bcff78

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ object Types {
109109
/** Is this type still provisional? This is the case if the type contains, or depends on,
110110
* uninstantiated type variables or type symbols that have the Provisional flag set.
111111
* This is an antimonotonic property - once a type is not provisional, it stays so forever.
112+
*
113+
* FIXME: The semantics of this flag are broken by the existence of `TypeVar#resetInst`,
114+
* a non-provisional type could go back to being provisional after
115+
* a call to `resetInst`. This means all caches that rely on `isProvisional`
116+
* can likely end up returning stale results.
112117
*/
113118
def isProvisional(using Context): Boolean = mightBeProvisional && testProvisional
114119

@@ -4743,6 +4748,10 @@ object Types {
47434748
* is different from the variable's creation state (meaning unrolls are possible)
47444749
* in the current typer state.
47454750
*
4751+
* FIXME: the "once" in the statement above is not true anymore now that `resetInst`
4752+
* exists, this is problematic for caching (see `Type#isProvisional`),
4753+
* we should try getting rid of this method.
4754+
*
47464755
* @param origin the parameter that's tracked by the type variable.
47474756
* @param creatorState the typer state in which the variable was created.
47484757
* @param initNestingLevel the initial nesting level of the type variable. (c.f. nestingLevel)

0 commit comments

Comments
 (0)