From 5ec9a57278028e6cabedbcb58fcc09e5f3eb8d2a Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Tue, 8 Aug 2023 22:31:21 +0300 Subject: [PATCH] wip --- src/Compiler/Checking/CheckExpressions.fs | 8 ++++---- src/Compiler/Checking/CheckExpressions.fsi | 2 +- src/Compiler/Checking/ConstraintSolver.fs | 14 +++++++------- src/Compiler/Checking/ConstraintSolver.fsi | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Compiler/Checking/CheckExpressions.fs b/src/Compiler/Checking/CheckExpressions.fs index 92c93b5a623..b83f8e83be2 100644 --- a/src/Compiler/Checking/CheckExpressions.fs +++ b/src/Compiler/Checking/CheckExpressions.fs @@ -430,9 +430,9 @@ type cenv = TcFileState let CopyAndFixupTypars g m rigid tpsorig = FreshenAndFixupTypars g m rigid [] [] tpsorig -let UnifyTypes (cenv: cenv) (env: TcEnv) m actualTy expectedTy = +let UnifyTypes (cenv: cenv) (env: TcEnv) m expectedTy actualTy = let g = cenv.g - AddCxTypeEqualsType env.eContextInfo env.DisplayEnv cenv.css m (tryNormalizeMeasureInType g actualTy) (tryNormalizeMeasureInType g expectedTy) + AddCxTypeEqualsType env.eContextInfo env.DisplayEnv cenv.css m (tryNormalizeMeasureInType g expectedTy) (tryNormalizeMeasureInType g actualTy) // If the overall type admits subsumption or type directed conversion, and the original unify would have failed, // then allow subsumption or type directed conversion. @@ -5849,10 +5849,10 @@ and CheckTupleIsCorrectLength g (env: TcEnv) m tupleTy (args: 'a list) tcArgs = if args.Length <> ptys.Length then let argTys = NewInferenceTypes g args suppressErrorReporting (fun () -> tcArgs argTys) - let expectedTy = TType_tuple (tupInfo, argTys) + let actualTy = TType_tuple (tupInfo, argTys) // We let error recovery handle this exception - error (ErrorFromAddingTypeEquation(g, env.DisplayEnv, tupleTy, expectedTy, + error (ErrorFromAddingTypeEquation(g, env.DisplayEnv, tupleTy, actualTy, (ConstraintSolverTupleDiffLengths(env.DisplayEnv, env.eContextInfo, ptys, argTys, m, m)), m)) and TcExprTuple (cenv: cenv) overallTy env tpenv (isExplicitStruct, args, m) = diff --git a/src/Compiler/Checking/CheckExpressions.fsi b/src/Compiler/Checking/CheckExpressions.fsi index b26381b6b02..0ecc045f05d 100644 --- a/src/Compiler/Checking/CheckExpressions.fsi +++ b/src/Compiler/Checking/CheckExpressions.fsi @@ -863,7 +863,7 @@ val TranslateSynValInfo: val TranslatePartialValReprInfo: tps: Typar list -> PrelimValReprInfo -> ValReprInfo /// Constrain two types to be equal within this type checking context -val UnifyTypes: cenv: TcFileState -> env: TcEnv -> m: range -> actualTy: TType -> expectedTy: TType -> unit +val UnifyTypes: cenv: TcFileState -> env: TcEnv -> m: range -> expectedTy: TType -> actualTy: TType -> unit val TcRuntimeTypeTest: isCast: bool -> diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index f80916c325e..db86aa3ad60 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -246,9 +246,9 @@ exception ConstraintSolverError of string * range * range exception ErrorFromApplyingDefault of tcGlobals: TcGlobals * displayEnv: DisplayEnv * Typar * TType * error: exn * range: range -exception ErrorFromAddingTypeEquation of tcGlobals: TcGlobals * displayEnv: DisplayEnv * actualTy: TType * expectedTy: TType * error: exn * range: range +exception ErrorFromAddingTypeEquation of tcGlobals: TcGlobals * displayEnv: DisplayEnv * expectedTy: TType * actualTy: TType * error: exn * range: range -exception ErrorsFromAddingSubsumptionConstraint of tcGlobals: TcGlobals * displayEnv: DisplayEnv * actualTy: TType * expectedTy: TType * error: exn * ctxtInfo: ContextInfo * parameterRange: range +exception ErrorsFromAddingSubsumptionConstraint of tcGlobals: TcGlobals * displayEnv: DisplayEnv * expectedTy: TType * actualTy: TType * error: exn * ctxtInfo: ContextInfo * parameterRange: range exception ErrorFromAddingConstraint of displayEnv: DisplayEnv * error: exn * range: range @@ -2713,12 +2713,12 @@ and SolveTypeSubsumesTypeWithWrappedContextualReport (csenv: ConstraintSolverEnv and SolveTypeSubsumesTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln origTy1 ty1 ty2 = SolveTypeSubsumesTypeWithWrappedContextualReport csenv ndeep m trace cxsln origTy1 ty1 ty2 id -and SolveTypeEqualsTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln actualTy expectedTy = +and SolveTypeEqualsTypeWithReport (csenv: ConstraintSolverEnv) ndeep m trace cxsln expectedTy actualTy = TryD - (fun () -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m trace cxsln actualTy expectedTy) + (fun () -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m trace cxsln expectedTy actualTy) (function | AbortForFailedMemberConstraintResolution as err -> ErrorD err - | res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, actualTy, expectedTy, res, m))) + | res -> ErrorD (ErrorFromAddingTypeEquation(csenv.g, csenv.DisplayEnv, expectedTy, actualTy, res, m))) and ArgsMustSubsumeOrConvert (csenv: ConstraintSolverEnv) @@ -3459,10 +3459,10 @@ let EliminateConstraintsForGeneralizedTypars (denv: DisplayEnv) css m (trace: Op // No error recovery here: we do that on a per-expression basis. //------------------------------------------------------------------------- -let AddCxTypeEqualsType contextInfo denv css m actual expected = +let AddCxTypeEqualsType contextInfo denv css m expected actual = let csenv = MakeConstraintSolverEnv contextInfo css m denv PostponeOnFailedMemberConstraintResolution csenv NoTrace - (fun csenv -> SolveTypeEqualsTypeWithReport csenv 0 m NoTrace None actual expected) + (fun csenv -> SolveTypeEqualsTypeWithReport csenv 0 m NoTrace None expected actual) ErrorD |> RaiseOperationResult diff --git a/src/Compiler/Checking/ConstraintSolver.fsi b/src/Compiler/Checking/ConstraintSolver.fsi index d6cc309c6b5..eb48ce3b439 100644 --- a/src/Compiler/Checking/ConstraintSolver.fsi +++ b/src/Compiler/Checking/ConstraintSolver.fsi @@ -187,16 +187,16 @@ exception ErrorFromApplyingDefault of exception ErrorFromAddingTypeEquation of tcGlobals: TcGlobals * displayEnv: DisplayEnv * - actualTy: TType * expectedTy: TType * + actualTy: TType * error: exn * range: range exception ErrorsFromAddingSubsumptionConstraint of tcGlobals: TcGlobals * displayEnv: DisplayEnv * - actualTy: TType * expectedTy: TType * + actualTy: TType * error: exn * ctxtInfo: ContextInfo * parameterRange: range