Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ open FSharp.Compiler.CheckExpressionsOps
open FSharp.Compiler.CheckExpressions
open FSharp.Compiler.NameResolution
open FSharp.Compiler.TypedTreeOps
open FSharp.Compiler.Features
open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.Syntax
open FSharp.Compiler.CheckSequenceExpressions

Expand Down Expand Up @@ -56,61 +54,49 @@ let TcArrayOrListComputedExpression (cenv: TcFileState) env (overallTy: OverallT
match comp with
| SimpleSemicolonSequence cenv false elems ->
let replacementExpr =
if isArray then
// This are to improve parsing/processing speed for parser tables by converting to an array blob ASAP
let nelems = elems.Length

if
nelems > 0
&& List.forall
(function
| SynExpr.Const(SynConst.UInt16 _, _) -> true
| _ -> false)
elems
then
SynExpr.Const(
SynConst.UInt16s(
Array.ofList (
List.map
(function
| SynExpr.Const(SynConst.UInt16 x, _) -> x
| _ -> failwith "unreachable")
elems
)
// This are to improve parsing/processing speed for parser tables by converting to an array blob ASAP
match isArray, elems with
| true, _ :: _ when
List.forall
(function
| SynExpr.Const(SynConst.UInt16 _, _) -> true
| _ -> false)
elems
->
SynExpr.Const(
SynConst.UInt16s(
Array.ofList (
List.map
(function
| SynExpr.Const(SynConst.UInt16 x, _) -> x
| _ -> failwith "unreachable")
elems
)
),
m
)
| true, _ :: _ when
List.forall
(function
| SynExpr.Const(SynConst.Byte _, _) -> true
| _ -> false)
elems
->
SynExpr.Const(
SynConst.Bytes(
Array.ofList (
List.map
(function
| SynExpr.Const(SynConst.Byte x, _) -> x
| _ -> failwith "unreachable")
elems
),
SynByteStringKind.Regular,
m
)
elif
nelems > 0
&& List.forall
(function
| SynExpr.Const(SynConst.Byte _, _) -> true
| _ -> false)
elems
then
SynExpr.Const(
SynConst.Bytes(
Array.ofList (
List.map
(function
| SynExpr.Const(SynConst.Byte x, _) -> x
| _ -> failwith "unreachable")
elems
),
SynByteStringKind.Regular,
m
),
m
)
else
SynExpr.ArrayOrList(isArray, elems, m)
else if cenv.g.langVersion.SupportsFeature(LanguageFeature.ReallyLongLists) then
SynExpr.ArrayOrList(isArray, elems, m)
else
if elems.Length > 500 then
error (Error(FSComp.SR.tcListLiteralMaxSize (), m))

SynExpr.ArrayOrList(isArray, elems, m)
),
m
)
| _ -> SynExpr.ArrayOrList(isArray, elems, m)

TcExprUndelayed cenv overallTy env tpenv replacementExpr
| _ ->
Expand Down
2 changes: 0 additions & 2 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ tcCouldNotFindIDisposable,"Couldn't find Dispose on IDisposable, or it was overl
740,tcInvalidSequenceExpressionSyntaxForm,"Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'"
tcExpressionWithIfRequiresParenthesis,"This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression"
741,tcUnableToParseFormatString,"Unable to parse format string '%s'"
742,tcListLiteralMaxSize,"This list expression exceeds the maximum size for list literals. Use an array for larger literals and call Array.ToList."
743,tcExpressionFormRequiresObjectConstructor,"The expression form 'expr then expr' may only be used as part of an explicit object constructor"
744,tcNamedArgumentsCannotBeUsedInMemberTraits,"Named arguments cannot be given to member trait calls"
745,tcNotValidEnumCaseName,"This is not a valid name for an enumeration case"
Expand Down Expand Up @@ -1558,7 +1557,6 @@ featureNullnessChecking,"nullness checking"
featureRuntimeAsync,"runtime async"
featureStringInterpolation,"string interpolation"
featureWitnessPassing,"witness passing for trait constraints in F# quotations"
featureReallyLongList,"list literals of any size"
featureErrorOnDeprecatedRequireQualifiedAccess,"give error on deprecated access of construct with RequireQualifiedAccess attribute"
featureMatchNotAllowedForUnionCaseWithNoData,"Pattern match discard is not allowed for union case that takes no data."
featureCSharpExtensionAttributeNotRequired,"Allow implicit Extension attribute on declaring types, modules"
Expand Down
3 changes: 0 additions & 3 deletions src/Compiler/Facilities/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type LanguageFeature =
| NullnessChecking
| UnionIsPropertiesVisible
| AttributesToRightOfModuleKeyword
| ReallyLongLists
| ErrorOnDeprecatedRequireQualifiedAccess
| MatchNotAllowedForUnionCaseWithNoData
| CSharpExtensionAttributeNotRequired
Expand Down Expand Up @@ -127,7 +126,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
LanguageFeature.AttributesToRightOfModuleKeyword, languageVersion60

// F# 7.0
LanguageFeature.ReallyLongLists, languageVersion70
LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess, languageVersion70

// F# 8.0
Expand Down Expand Up @@ -296,7 +294,6 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
| LanguageFeature.ExpandedMeasurables -> FSComp.SR.featureExpandedMeasurables ()
| LanguageFeature.UnionIsPropertiesVisible -> FSComp.SR.featureUnionIsPropertiesVisible ()
| LanguageFeature.AttributesToRightOfModuleKeyword -> FSComp.SR.featureAttributesToRightOfModuleKeyword ()
| LanguageFeature.ReallyLongLists -> FSComp.SR.featureReallyLongList ()
| LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess -> FSComp.SR.featureErrorOnDeprecatedRequireQualifiedAccess ()
| LanguageFeature.MatchNotAllowedForUnionCaseWithNoData -> FSComp.SR.featureMatchNotAllowedForUnionCaseWithNoData ()
| LanguageFeature.CSharpExtensionAttributeNotRequired -> FSComp.SR.featureCSharpExtensionAttributeNotRequired ()
Expand Down
1 change: 0 additions & 1 deletion src/Compiler/Facilities/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type LanguageFeature =
| NullnessChecking
| UnionIsPropertiesVisible
| AttributesToRightOfModuleKeyword
| ReallyLongLists
| ErrorOnDeprecatedRequireQualifiedAccess
| MatchNotAllowedForUnionCaseWithNoData
| CSharpExtensionAttributeNotRequired
Expand Down
10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions src/Compiler/xlf/FSComp.txt.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading