Skip to content

Commit 2897230

Browse files
authored
Fix two bugs related to tasks (#12195)
* fix srtp processing related to tasks * fix 12189 - bad codegen for tasks. Also eliminate 'trace' parameter and put it in the constraint solver context instead * fix 12189 - bad codegen for tasks. Also eliminate 'trace' parameter and put it in the constraint solver context instead * fix 12189 - bad codegen for tasks. Also eliminate 'trace' parameter and put it in the constraint solver context instead * fix 12189 - bad codegen for tasks. Also eliminate 'trace' parameter and put it in the constraint solver context instead * cleanup and fix method arg lambda propagation rule * fix error messages * fix error messages * fix error messages * fix error messages * simplify diff * simplify diff * reduce diff and fix errors * reduce diff and fix errors
1 parent 6854294 commit 2897230

File tree

8 files changed

+553
-126
lines changed

8 files changed

+553
-126
lines changed

src/fsharp/CheckDeclarations.fs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5876,6 +5876,14 @@ let TypeCheckOneImplFile
58765876

58775877
let extraAttribs = topAttrs.mainMethodAttrs@topAttrs.netModuleAttrs@topAttrs.assemblyAttrs
58785878

5879+
// Run any additional checks registered to be run before applying defaults
5880+
do
5881+
for check in cenv.css.GetPostInferenceChecksPreDefaults() do
5882+
try
5883+
check()
5884+
with e ->
5885+
errorRecovery e m
5886+
58795887
conditionallySuppressErrorReporting (checkForErrors()) (fun () ->
58805888
ApplyDefaults cenv g denvAtEnd m mexpr extraAttribs)
58815889

@@ -5899,10 +5907,9 @@ let TypeCheckOneImplFile
58995907
conditionallySuppressErrorReporting (checkForErrors()) (fun () ->
59005908
CheckModuleSignature g cenv m denvAtEnd rootSigOpt implFileTypePriorToSig implFileSpecPriorToSig mexpr)
59015909

5902-
// Run any additional checks registered for post-type-inference
59035910
do
59045911
conditionallySuppressErrorReporting (checkForErrors()) (fun () ->
5905-
for check in cenv.postInferenceChecks do
5912+
for check in cenv.css.GetPostInferenceChecksFinal() do
59065913
try
59075914
check()
59085915
with e ->

src/fsharp/CheckExpressions.fs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,6 @@ type TcFileState =
359359
/// we infer type parameters
360360
mutable recUses: ValMultiMap<Expr ref * range * bool>
361361

362-
/// Checks to run after all inference is complete.
363-
mutable postInferenceChecks: ResizeArray<unit -> unit>
364-
365362
/// Set to true if this file causes the creation of generated provided types.
366363
mutable createsGeneratedProvidedTypes: bool
367364

@@ -425,7 +422,6 @@ type TcFileState =
425422
{ g = g
426423
amap = amap
427424
recUses = ValMultiMap<_>.Empty
428-
postInferenceChecks = ResizeArray()
429425
createsGeneratedProvidedTypes = false
430426
topCcu = topCcu
431427
isScript = isScript
@@ -2624,7 +2620,7 @@ let TcValEarlyGeneralizationConsistencyCheck cenv (env: TcEnv) (v: Val, vrec, ti
26242620
match vrec with
26252621
| ValInRecScope isComplete when isComplete && not (isNil tinst) ->
26262622
//printfn "pushing post-inference check for '%s', vty = '%s'" v.DisplayName (DebugPrint.showType vty)
2627-
cenv.postInferenceChecks.Add (fun () ->
2623+
cenv.css.PushPostInferenceCheck (preDefaults=false, check=fun () ->
26282624
//printfn "running post-inference check for '%s'" v.DisplayName
26292625
//printfn "tau = '%s'" (DebugPrint.showType tau)
26302626
//printfn "vty = '%s'" (DebugPrint.showType vty)
@@ -9184,7 +9180,7 @@ and TcMethodApplication
91849180
CanonicalizePartialInferenceProblem cenv.css denv mItem
91859181
(unnamedCurriedCallerArgs |> List.collectSquared (fun callerArg -> freeInTypeLeftToRight cenv.g false callerArg.CallerArgumentType))
91869182

9187-
let result, errors = ResolveOverloadingForCall denv cenv.css mMethExpr methodName 0 None callerArgs ad postArgumentTypeCheckingCalledMethGroup true (Some returnTy)
9183+
let result, errors = ResolveOverloadingForCall denv cenv.css mMethExpr methodName callerArgs ad postArgumentTypeCheckingCalledMethGroup true returnTy
91889184

91899185
match afterResolution, result with
91909186
| AfterResolution.DoNothing, _ -> ()

src/fsharp/CheckExpressions.fsi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ type TcFileState =
180180
/// we infer type parameters
181181
mutable recUses: ValMultiMap<Expr ref * range * bool>
182182

183-
/// Checks to run after all inference is complete.
184-
mutable postInferenceChecks: ResizeArray<unit -> unit>
185-
186183
/// Set to true if this file causes the creation of generated provided types.
187184
mutable createsGeneratedProvidedTypes: bool
188185

src/fsharp/CompilerDiagnostics.fs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ let GetRangeOfDiagnostic(err: PhasedDiagnostic) =
175175
| ConstraintSolverTypesNotInEqualityRelation(_, _, _, m, _, _)
176176
| ConstraintSolverError(_, m, _)
177177
| ConstraintSolverTypesNotInSubsumptionRelation(_, _, _, m, _)
178-
| ConstraintSolverRelatedInformation(_, m, _)
179178
| SelfRefObjCtor(_, m) ->
180179
Some m
181180

@@ -373,6 +372,7 @@ let IsWarningOrInfoEnabled (err, severity) n level specificWarnOn =
373372
match n with
374373
| 1182 -> false // chkUnusedValue - off by default
375374
| 3180 -> false // abImplicitHeapAllocation - off by default
375+
| 3186 -> false // pickleMissingDefinition - off by default
376376
| 3366 -> false //tcIndexNotationDeprecated - currently off by default
377377
| 3517 -> false // optFailedToInlineSuggestedValue - off by default
378378
| 3388 -> false // tcSubsumptionImplicitConversionUsed - off by default
@@ -385,9 +385,6 @@ let IsWarningOrInfoEnabled (err, severity) n level specificWarnOn =
385385
let SplitRelatedDiagnostics(err: PhasedDiagnostic) : PhasedDiagnostic * PhasedDiagnostic list =
386386
let ToPhased e = {Exception=e; Phase = err.Phase}
387387
let rec SplitRelatedException = function
388-
| ConstraintSolverRelatedInformation(fopt, m2, e) ->
389-
let e, related = SplitRelatedException e
390-
ConstraintSolverRelatedInformation(fopt, m2, e.Exception)|>ToPhased, related
391388
| ErrorFromAddingTypeEquation(g, denv, t1, t2, e, m) ->
392389
let e, related = SplitRelatedException e
393390
ErrorFromAddingTypeEquation(g, denv, t1, t2, e.Exception, m)|>ToPhased, related
@@ -664,12 +661,6 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa
664661
if m.StartLine <> m2.StartLine then
665662
os.Append(SeeAlsoE().Format (stringOfRange m2)) |> ignore
666663

667-
| ConstraintSolverRelatedInformation(fopt, _, e) ->
668-
match e with
669-
| ConstraintSolverError _ -> OutputExceptionR os e
670-
| _ -> ()
671-
fopt |> Option.iter (Printf.bprintf os " %s")
672-
673664
| ErrorFromAddingTypeEquation(g, denv, t1, t2, ConstraintSolverTypesNotInEqualityRelation(_, t1', t2', m, _, contextInfo), _)
674665
when typeEquiv g t1 t1'
675666
&& typeEquiv g t2 t2' ->

0 commit comments

Comments
 (0)