Skip to content

Commit

Permalink
Better check
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarfgp committed Sep 28, 2024
1 parent 45ab45e commit de89b44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
11 changes: 11 additions & 0 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5890,6 +5890,17 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, pat, synEnumExpr, synBodyExpr, m, spFor, spIn, m)

| SynExpr.ComputationExpr (hasSeqBuilder, comp, m) ->
let isIndexRange = match comp with | SynExpr.IndexRange _ -> true | _ -> false
let deprecatedPlacesWhereSeqCanBeOmitted =
cenv.g.langVersion.SupportsFeature LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted
if
deprecatedPlacesWhereSeqCanBeOmitted
&& isIndexRange
&& not hasSeqBuilder
&& not cenv.g.compilingFSharpCore
then
warning (Error(FSComp.SR.chkDeprecatePlacesWhereSeqCanBeOmitted (), m))

let env = ExitFamilyRegion env
cenv.TcSequenceExpressionEntry cenv env overallTy tpenv (hasSeqBuilder, comp) m

Expand Down
13 changes: 1 addition & 12 deletions src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -442,18 +442,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT

let TcSequenceExpressionEntry (cenv: TcFileState) env (overallTy: OverallTy) tpenv (hasBuilder, comp) m =
match RewriteRangeExpr comp with
| Some replacementExpr ->
let deprecatedPlacesWhereSeqCanBeOmitted =
cenv.g.langVersion.SupportsFeature LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted

if
deprecatedPlacesWhereSeqCanBeOmitted
&& not hasBuilder
&& not cenv.g.compilingFSharpCore
then
warning (Error(FSComp.SR.chkDeprecatePlacesWhereSeqCanBeOmitted (), m))

TcExpr cenv overallTy env tpenv replacementExpr
| Some replacementExpr -> TcExpr cenv overallTy env tpenv replacementExpr
| None ->
let implicitYieldEnabled =
cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield
Expand Down

0 comments on commit de89b44

Please sign in to comment.