Skip to content

Commit 22cfe3a

Browse files
committed
Further tweak co/contra inference logic
1 parent 1fddd46 commit 22cfe3a

File tree

3 files changed

+2
-208
lines changed

3 files changed

+2
-208
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24578,8 +24578,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
2457824578
// parameter and has inferences that would conflict. Otherwise, we use the contra-variant inference.
2457924579
const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & TypeFlags.Never) &&
2458024580
some(inference.contraCandidates, t => isTypeSubtypeOf(inferredCovariantType, t)) &&
24581-
every(context.inferences, other => other === inference ||
24582-
getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter ||
24581+
every(context.inferences, other =>
24582+
other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter ||
2458324583
every(other.candidates, t => isTypeSubtypeOf(t, inferredCovariantType)));
2458424584
inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference);
2458524585
}

tests/baselines/reference/coAndContraVariantInferences3.errors.txt

Lines changed: 0 additions & 168 deletions
This file was deleted.

tests/baselines/reference/coAndContraVariantInferences4.errors.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)