RFC FS-1033: Deprecate places where `seq` can be omitted (#17772)

* Treat `{ 1..10 }` as sequence expression

* deprecate { start..finish } and { start..step..finish }

* fix build part1

* 3873., chkDeprecatePlacesWhereSeqCanBeOmitted

* more tests

* release notes

* reorg seq tests

* Better check

* fix merge conflicts

* Add code fix for adding missing `seq` before `{…}`

* More tests

* Fmt

* update release notes

* more editor tests

---------

Co-authored-by: Brian Rourke Boll <brianrourkeboll@gmail.com>
This commit is contained in:
Edgar Gonzalez 2024-10-21 11:31:27 +01:00 коммит произвёл GitHub
Родитель 62328fcf5c
Коммит 315966454b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
53 изменённых файлов: 940 добавлений и 121 удалений

Просмотреть файл

@ -8,7 +8,7 @@
* Fix nullness inference for member val and other OO scenarios ([PR #17845](https://github.com/dotnet/fsharp/pull/17845)) * Fix nullness inference for member val and other OO scenarios ([PR #17845](https://github.com/dotnet/fsharp/pull/17845))
### Added ### Added
* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772))
* Support literal attribute on decimals ([PR #17769](https://github.com/dotnet/fsharp/pull/17769)) * Support literal attribute on decimals ([PR #17769](https://github.com/dotnet/fsharp/pull/17769))
### Changed ### Changed

Просмотреть файл

@ -1,6 +1,7 @@
### Added ### Added
* Better generic unmanaged structs handling. ([Language suggestion #692](https://github.com/fsharp/fslang-suggestions/issues/692), [PR #12154](https://github.com/dotnet/fsharp/pull/12154)) * Better generic unmanaged structs handling. ([Language suggestion #692](https://github.com/fsharp/fslang-suggestions/issues/692), [PR #12154](https://github.com/dotnet/fsharp/pull/12154))
* Deprecate places where `seq` can be omitted. ([Language suggestion #1033](https://github.com/fsharp/fslang-suggestions/issues/1033), [PR #17772](https://github.com/dotnet/fsharp/pull/17772))
### Fixed ### Fixed

Просмотреть файл

@ -0,0 +1,8 @@
### Fixed
### Added
* Code fix for adding missing `seq`. ([PR #17772](https://github.com/dotnet/fsharp/pull/17772))
### Changed
### Breaking Changes

Просмотреть файл

@ -5891,6 +5891,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) TcForEachExpr cenv overallTy env tpenv (seqExprOnly, isFromSource, pat, synEnumExpr, synBodyExpr, m, spFor, spIn, m)
| SynExpr.ComputationExpr (hasSeqBuilder, comp, 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 let env = ExitFamilyRegion env
cenv.TcSequenceExpressionEntry cenv env overallTy tpenv (hasSeqBuilder, comp) m cenv.TcSequenceExpressionEntry cenv env overallTy tpenv (hasSeqBuilder, comp) m

Просмотреть файл

@ -1783,4 +1783,6 @@ featureEmptyBodiedComputationExpressions,"Support for computation expressions wi
featureAllowAccessModifiersToAutoPropertiesGettersAndSetters,"Allow access modifiers to auto properties getters and setters" featureAllowAccessModifiersToAutoPropertiesGettersAndSetters,"Allow access modifiers to auto properties getters and setters"
3871,tcAccessModifiersNotAllowedInSRTPConstraint,"Access modifiers cannot be applied to an SRTP constraint." 3871,tcAccessModifiersNotAllowedInSRTPConstraint,"Access modifiers cannot be applied to an SRTP constraint."
featureAllowObjectExpressionWithoutOverrides,"Allow object expressions without overrides" featureAllowObjectExpressionWithoutOverrides,"Allow object expressions without overrides"
3872,tcPartialActivePattern,"Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern." 3872,tcPartialActivePattern,"Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern."
3873,chkDeprecatePlacesWhereSeqCanBeOmitted,"This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'"
featureDeprecatePlacesWhereSeqCanBeOmitted,"Deprecate places where 'seq' can be omitted"

Просмотреть файл

@ -94,6 +94,7 @@ type LanguageFeature =
| ParsedHashDirectiveArgumentNonQuotes | ParsedHashDirectiveArgumentNonQuotes
| EmptyBodiedComputationExpressions | EmptyBodiedComputationExpressions
| AllowObjectExpressionWithoutOverrides | AllowObjectExpressionWithoutOverrides
| DeprecatePlacesWhereSeqCanBeOmitted
/// LanguageVersion management /// LanguageVersion management
type LanguageVersion(versionText) = type LanguageVersion(versionText) =
@ -219,6 +220,7 @@ type LanguageVersion(versionText) =
LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work
LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion
LanguageFeature.AllowObjectExpressionWithoutOverrides, previewVersion LanguageFeature.AllowObjectExpressionWithoutOverrides, previewVersion
LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted, previewVersion
] ]
static let defaultLanguageVersion = LanguageVersion("default") static let defaultLanguageVersion = LanguageVersion("default")
@ -375,6 +377,7 @@ type LanguageVersion(versionText) =
| LanguageFeature.ParsedHashDirectiveArgumentNonQuotes -> FSComp.SR.featureParsedHashDirectiveArgumentNonString () | LanguageFeature.ParsedHashDirectiveArgumentNonQuotes -> FSComp.SR.featureParsedHashDirectiveArgumentNonString ()
| LanguageFeature.EmptyBodiedComputationExpressions -> FSComp.SR.featureEmptyBodiedComputationExpressions () | LanguageFeature.EmptyBodiedComputationExpressions -> FSComp.SR.featureEmptyBodiedComputationExpressions ()
| LanguageFeature.AllowObjectExpressionWithoutOverrides -> FSComp.SR.featureAllowObjectExpressionWithoutOverrides () | LanguageFeature.AllowObjectExpressionWithoutOverrides -> FSComp.SR.featureAllowObjectExpressionWithoutOverrides ()
| LanguageFeature.DeprecatePlacesWhereSeqCanBeOmitted -> FSComp.SR.featureDeprecatePlacesWhereSeqCanBeOmitted ()
/// Get a version string associated with the given feature. /// Get a version string associated with the given feature.
static member GetFeatureVersionString feature = static member GetFeatureVersionString feature =

Просмотреть файл

@ -85,6 +85,7 @@ type LanguageFeature =
| ParsedHashDirectiveArgumentNonQuotes | ParsedHashDirectiveArgumentNonQuotes
| EmptyBodiedComputationExpressions | EmptyBodiedComputationExpressions
| AllowObjectExpressionWithoutOverrides | AllowObjectExpressionWithoutOverrides
| DeprecatePlacesWhereSeqCanBeOmitted
/// LanguageVersion management /// LanguageVersion management
type LanguageVersion = type LanguageVersion =

12
src/Compiler/xlf/FSComp.txt.cs.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Tento výraz je anonymní záznam, použijte {{|...|}} místo {{...}}.</target> <target state="translated">Tento výraz je anonymní záznam, použijte {{|...|}} místo {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Duplicitní parametr Parametr {0} byl v této metodě použit vícekrát.</target> <target state="translated">Duplicitní parametr Parametr {0} byl v této metodě použit vícekrát.</target>
@ -322,6 +327,11 @@
<target state="translated">opravit překlad názvů typů delegátů, viz https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">opravit překlad názvů typů delegátů, viz https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">vzor discard ve vazbě použití</target> <target state="translated">vzor discard ve vazbě použití</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Neplatný výraz záznamu, pořadí nebo výpočtu. Výrazy pořadí by měly mít notaci seq {{ ... }}.</target> <target state="needs-review-translation">Neplatný výraz záznamu, pořadí nebo výpočtu. Výrazy pořadí by měly mít notaci seq {{ ... }}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.de.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Dieser Ausdruck ist ein anonymer Datensatz. Verwenden Sie {{|...|}} anstelle von {{...}}.</target> <target state="translated">Dieser Ausdruck ist ein anonymer Datensatz. Verwenden Sie {{|...|}} anstelle von {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Doppelter Parameter. Der Parameter „{0}“ wurde in dieser Methode mehrmals verwendet.</target> <target state="translated">Doppelter Parameter. Der Parameter „{0}“ wurde in dieser Methode mehrmals verwendet.</target>
@ -322,6 +327,11 @@
<target state="translated">Informationen zur Problembehebung bezüglich der Auflösung von Delegattypnamen finden Sie unter https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">Informationen zur Problembehebung bezüglich der Auflösung von Delegattypnamen finden Sie unter https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">Das Verwerfen des verwendeten Musters ist verbindlich.</target> <target state="translated">Das Verwerfen des verwendeten Musters ist verbindlich.</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Ungültiger Datensatz-, Sequenz- oder Berechnungsausdruck. Sequenzausdrücke müssen das Format "seq {{ ... }}" besitzen.</target> <target state="needs-review-translation">Ungültiger Datensatz-, Sequenz- oder Berechnungsausdruck. Sequenzausdrücke müssen das Format "seq {{ ... }}" besitzen.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.es.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Esta expresión es un registro anónimo; use {{|...|}} en lugar de {{...}}.</target> <target state="translated">Esta expresión es un registro anónimo; use {{|...|}} en lugar de {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Parámetro duplicado. El parámetro '{0}' se ha usado más una vez en este método.</target> <target state="translated">Parámetro duplicado. El parámetro '{0}' se ha usado más una vez en este método.</target>
@ -322,6 +327,11 @@
<target state="translated">corrección para la resolución de nombres de tipo de delegado, consulte https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">corrección para la resolución de nombres de tipo de delegado, consulte https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">descartar enlace de patrón en uso</target> <target state="translated">descartar enlace de patrón en uso</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Expresión de registro, secuencia o cómputo no válida. Las expresiones de secuencia deben tener el formato 'seq {{ ... }}'.</target> <target state="needs-review-translation">Expresión de registro, secuencia o cómputo no válida. Las expresiones de secuencia deben tener el formato 'seq {{ ... }}'.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.fr.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Cette expression est un enregistrement anonyme, utilisez {{|...|}} au lieu de {{...}}.</target> <target state="translated">Cette expression est un enregistrement anonyme, utilisez {{|...|}} au lieu de {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Paramètre dupliqué. Le paramètre « {0} » a été utilisé une fois de plus dans cette méthode.</target> <target state="translated">Paramètre dupliqué. Le paramètre « {0} » a été utilisé une fois de plus dans cette méthode.</target>
@ -322,6 +327,11 @@
<target state="translated">corriger pour résoudre les noms de types délégués, voir https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">corriger pour résoudre les noms de types délégués, voir https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">annuler le modèle dans la liaison dutilisation</target> <target state="translated">annuler le modèle dans la liaison dutilisation</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Expression d'enregistrement, de séquence ou de calcul non valide. Les expressions de séquence doivent avoir le format 'seq {{ ... }}'</target> <target state="needs-review-translation">Expression d'enregistrement, de séquence ou de calcul non valide. Les expressions de séquence doivent avoir le format 'seq {{ ... }}'</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.it.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Questa espressione è un record anonimo. Usa {{|...|}} invece di {{...}}.</target> <target state="translated">Questa espressione è un record anonimo. Usa {{|...|}} invece di {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Parametro duplicato. Il parametro '{0}' è stato utilizzato più volte in questo metodo.</target> <target state="translated">Parametro duplicato. Il parametro '{0}' è stato utilizzato più volte in questo metodo.</target>
@ -322,6 +327,11 @@
<target state="translated">correggere la risoluzione dei nomi dei tipi delegati, vedere https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">correggere la risoluzione dei nomi dei tipi delegati, vedere https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">rimuovi criterio nell'utilizzo dell'associazione</target> <target state="translated">rimuovi criterio nell'utilizzo dell'associazione</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Espressione di calcolo, sequenza o record non valida. Il formato delle espressioni sequenza deve essere 'seq {{ ... }}'</target> <target state="needs-review-translation">Espressione di calcolo, sequenza o record non valida. Il formato delle espressioni sequenza deve essere 'seq {{ ... }}'</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.ja.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">この式は匿名レコードであり、{{...}} の代わりに {{|...|}} を使用してください。</target> <target state="translated">この式は匿名レコードであり、{{...}} の代わりに {{|...|}} を使用してください。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">パラメーターが重複しています。パラメーター '{0}' は、このメソッドで 1 回以上使用されています。</target> <target state="translated">パラメーターが重複しています。パラメーター '{0}' は、このメソッドで 1 回以上使用されています。</target>
@ -322,6 +327,11 @@
<target state="translated">デリゲート型名の解決を修正するには、https://github.com/dotnet/fsharp/issues/10228 を参照してください</target> <target state="translated">デリゲート型名の解決を修正するには、https://github.com/dotnet/fsharp/issues/10228 を参照してください</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">使用バインドでパターンを破棄する</target> <target state="translated">使用バインドでパターンを破棄する</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">無効なレコード、シーケンス式、またはコンピュテーション式です。シーケンス式は 'seq {{ ... }}' という形式にしてください。</target> <target state="needs-review-translation">無効なレコード、シーケンス式、またはコンピュテーション式です。シーケンス式は 'seq {{ ... }}' という形式にしてください。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.ko.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">이 식은 익명 레코드입니다. {{...}} 대신 {{|...|}}을 사용하세요.</target> <target state="translated">이 식은 익명 레코드입니다. {{...}} 대신 {{|...|}}을 사용하세요.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">매개 변수가 중복되었습니다. 이 메소드에서 매개 변수 '{0}'이(가) 두 번 이상 사용되었습니다.</target> <target state="translated">매개 변수가 중복되었습니다. 이 메소드에서 매개 변수 '{0}'이(가) 두 번 이상 사용되었습니다.</target>
@ -322,6 +327,11 @@
<target state="translated">대리자 형식 이름의 해결 방법을 수정합니다. https://github.com/dotnet/fsharp/issues/10228 참조하세요.</target> <target state="translated">대리자 형식 이름의 해결 방법을 수정합니다. https://github.com/dotnet/fsharp/issues/10228 참조하세요.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">사용 중인 패턴 바인딩 무시</target> <target state="translated">사용 중인 패턴 바인딩 무시</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">레코드, 시퀀스 또는 계산 식이 잘못되었습니다. 시퀀스 식의 형식은 'seq {{ ... }}'여야 합니다.</target> <target state="needs-review-translation">레코드, 시퀀스 또는 계산 식이 잘못되었습니다. 시퀀스 식의 형식은 'seq {{ ... }}'여야 합니다.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.pl.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">To wyrażenie jest rekordem anonimowym. Użyj {{|...|}} zamiast {{...}}.</target> <target state="translated">To wyrażenie jest rekordem anonimowym. Użyj {{|...|}} zamiast {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Zduplikowany parametr. Parametr „{0}” został użyty więcej niż raz w tej metodzie.</target> <target state="translated">Zduplikowany parametr. Parametr „{0}” został użyty więcej niż raz w tej metodzie.</target>
@ -322,6 +327,11 @@
<target state="translated">naprawa rozpoznawania nazw typów delegatów, sprawdź stronę https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">naprawa rozpoznawania nazw typów delegatów, sprawdź stronę https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">odrzuć wzorzec w powiązaniu użycia</target> <target state="translated">odrzuć wzorzec w powiązaniu użycia</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Nieprawidłowe wyrażenie rekordu, sekwencji lub obliczenia. Wyrażenia sekwencji powinny mieć postać „seq {{ ... }}”</target> <target state="needs-review-translation">Nieprawidłowe wyrażenie rekordu, sekwencji lub obliczenia. Wyrażenia sekwencji powinny mieć postać „seq {{ ... }}”</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.pt-BR.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Esta expressão é um registro anônimo, use {{|...|}} em vez de {{...}}.</target> <target state="translated">Esta expressão é um registro anônimo, use {{|...|}} em vez de {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Parâmetro duplicado. O parâmetro '{0}' foi usado mais de uma vez neste método.</target> <target state="translated">Parâmetro duplicado. O parâmetro '{0}' foi usado mais de uma vez neste método.</target>
@ -322,6 +327,11 @@
<target state="translated">corrigir para resolução de nomes de tipos delegados, consulte https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">corrigir para resolução de nomes de tipos delegados, consulte https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">descartar o padrão em uso de associação</target> <target state="translated">descartar o padrão em uso de associação</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Expressão de registro, sequência ou computação inválida. Expressões de sequência devem estar na forma 'seq {{ ... }}'</target> <target state="needs-review-translation">Expressão de registro, sequência ou computação inválida. Expressões de sequência devem estar na forma 'seq {{ ... }}'</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.ru.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Это выражение является анонимной записью. Используйте {{|...|}} вместо {{...}}.</target> <target state="translated">Это выражение является анонимной записью. Используйте {{|...|}} вместо {{...}}.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Повторяющийся параметр. Параметр "{0}" использовался в этом методе несколько раз.</target> <target state="translated">Повторяющийся параметр. Параметр "{0}" использовался в этом методе несколько раз.</target>
@ -322,6 +327,11 @@
<target state="translated">исправить разрешение имен типов делегатов, см. https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">исправить разрешение имен типов делегатов, см. https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">шаблон отмены в привязке использования</target> <target state="translated">шаблон отмены в привязке использования</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Недопустимая запись, выражение последовательности или вычислительное выражение. Выражения последовательностей должны иметь форму "seq {{ ... }}'</target> <target state="needs-review-translation">Недопустимая запись, выражение последовательности или вычислительное выражение. Выражения последовательностей должны иметь форму "seq {{ ... }}'</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.tr.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">Bu ifade, anonim bir kayıt, {{...}} yerine {{|...|}} kullanın.</target> <target state="translated">Bu ifade, anonim bir kayıt, {{...}} yerine {{|...|}} kullanın.</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">Yinelenen parametre. '{0}' parametresi bu metotta bir kereden fazla kullanıldı.</target> <target state="translated">Yinelenen parametre. '{0}' parametresi bu metotta bir kereden fazla kullanıldı.</target>
@ -322,6 +327,11 @@
<target state="translated">temsilci türü adlarının çözümlenmesiyle ilgili sorunun çözümü için bkz. https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">temsilci türü adlarının çözümlenmesiyle ilgili sorunun çözümü için bkz. https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">kullanım bağlamasında deseni at</target> <target state="translated">kullanım bağlamasında deseni at</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">Geçersiz kayıt, dizi veya hesaplama ifadesi. Dizi ifadeleri 'seq {{ ... }}' biçiminde olmalıdır</target> <target state="needs-review-translation">Geçersiz kayıt, dizi veya hesaplama ifadesi. Dizi ifadeleri 'seq {{ ... }}' biçiminde olmalıdır</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.zh-Hans.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">此表达式是匿名记录,请使用 {{|...|}} 而不是 {{...}}。</target> <target state="translated">此表达式是匿名记录,请使用 {{|...|}} 而不是 {{...}}。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">参数重复。此方法中多次使用了参数“{0}”。</target> <target state="translated">参数重复。此方法中多次使用了参数“{0}”。</target>
@ -322,6 +327,11 @@
<target state="translated">修复了委托类型名称的解析,请参阅 https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">修复了委托类型名称的解析,请参阅 https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">放弃使用绑定模式</target> <target state="translated">放弃使用绑定模式</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">记录、序列或计算表达式无效。序列表达式的格式应为“seq {{ ... }}”</target> <target state="needs-review-translation">记录、序列或计算表达式无效。序列表达式的格式应为“seq {{ ... }}”</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

12
src/Compiler/xlf/FSComp.txt.zh-Hant.xlf сгенерированный
Просмотреть файл

@ -52,6 +52,11 @@
<target state="translated">此運算式是匿名記錄,請使用 {{|...|}} 而不是 {{...}}。</target> <target state="translated">此運算式是匿名記錄,請使用 {{|...|}} 而不是 {{...}}。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="chkDeprecatePlacesWhereSeqCanBeOmitted">
<source>This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="new">This construct is deprecated. Sequence expressions should be of the form 'seq {{ ... }}'</target>
<note />
</trans-unit>
<trans-unit id="chkDuplicatedMethodParameter"> <trans-unit id="chkDuplicatedMethodParameter">
<source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source> <source>Duplicate parameter. The parameter '{0}' has been used more that once in this method.</source>
<target state="translated">重複的參數。參數 '{0}' 在此方法中使用多次。</target> <target state="translated">重複的參數。參數 '{0}' 在此方法中使用多次。</target>
@ -322,6 +327,11 @@
<target state="translated">修正委派類型名稱的解析,請參閱 https://github.com/dotnet/fsharp/issues/10228</target> <target state="translated">修正委派類型名稱的解析,請參閱 https://github.com/dotnet/fsharp/issues/10228</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="featureDeprecatePlacesWhereSeqCanBeOmitted">
<source>Deprecate places where 'seq' can be omitted</source>
<target state="new">Deprecate places where 'seq' can be omitted</target>
<note />
</trans-unit>
<trans-unit id="featureDiscardUseValue"> <trans-unit id="featureDiscardUseValue">
<source>discard pattern in use binding</source> <source>discard pattern in use binding</source>
<target state="translated">捨棄使用繫結中的模式</target> <target state="translated">捨棄使用繫結中的模式</target>
@ -4524,7 +4534,7 @@
</trans-unit> </trans-unit>
<trans-unit id="tcInvalidSequenceExpressionSyntaxForm"> <trans-unit id="tcInvalidSequenceExpressionSyntaxForm">
<source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source> <source>Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'</source>
<target state="translated">無效的記錄、循序項或計算運算式。循序項運算式應該是 'seq {{ ... }}' 形式。</target> <target state="needs-review-translation">無效的記錄、循序項或計算運算式。循序項運算式應該是 'seq {{ ... }}' 形式。</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="tcExpressionWithIfRequiresParenthesis"> <trans-unit id="tcExpressionWithIfRequiresParenthesis">

Просмотреть файл

@ -223,6 +223,7 @@
<Compile Include="Language\RegressionTests.fs" /> <Compile Include="Language\RegressionTests.fs" />
<Compile Include="Language\AttributeCheckingTests.fs" /> <Compile Include="Language\AttributeCheckingTests.fs" />
<Compile Include="Language\ObsoleteAttributeCheckingTests.fs" /> <Compile Include="Language\ObsoleteAttributeCheckingTests.fs" />
<Compile Include="Language\SequenceExpressions\SequenceExpressionTests.fs" />
<Compile Include="Language\XmlComments.fs" /> <Compile Include="Language\XmlComments.fs" />
<Compile Include="Language\CompilerDirectiveTests.fs" /> <Compile Include="Language\CompilerDirectiveTests.fs" />
<Compile Include="Language\CodeQuotationTests.fs" /> <Compile Include="Language\CodeQuotationTests.fs" />
@ -237,7 +238,6 @@
<Compile Include="Language\FixedBindings\FixedBindings.fs" /> <Compile Include="Language\FixedBindings\FixedBindings.fs" />
<Compile Include="Language\ExtensionMethodTests.fs" /> <Compile Include="Language\ExtensionMethodTests.fs" />
<Compile Include="Language\WhileBangTests.fs" /> <Compile Include="Language\WhileBangTests.fs" />
<Compile Include="Language\SequenceExpressionTests.fs" />
<Compile Include="Language\StaticClassTests.fs" /> <Compile Include="Language\StaticClassTests.fs" />
<Compile Include="Language\PrintfFormatTests.fs" /> <Compile Include="Language\PrintfFormatTests.fs" />
<Compile Include="Language\InterfaceTests.fs" /> <Compile Include="Language\InterfaceTests.fs" />

Просмотреть файл

@ -0,0 +1,76 @@
{ 1..10 }
{ 1..5..10 }
[| { 1..10 } |]
[| { 1..5..10 } |]
let a = { 1..10 }
let a3 = { 1..10..20 }
let b = [| { 1..10 } |]
let b3 = [| { 1..10..20 } |]
let c = [ { 1..10 } ]
[| { 1..10 } |]
[| yield { 1..10 } |]
[ { 1..10 } ]
[ { 1..10..10 } ]
[ yield { 1..10 } ]
[ yield { 1..10..20 } ]
ResizeArray({ 1..10 })
ResizeArray({ 1..10..20 })
let fw start finish = [ for x in { start..finish } -> x ]
let fe start finish = [| for x in { start..finish } -> x |]
for x in { 1..10 } do ()
for x in { 1..5..10 } do ()
let f = Seq.head
let a2 = f { 1..6 }
let a23 = f { 1..6..10 }
let b2 = set { 1..6 }
let f10 start finish = for x in { start..finish } do ignore (float x ** float x)
let (..) _ _ = "lol"
let lol1 = { 1..10 }
{ 1..5..10 }
let resultInt = Seq.length {1..8}
let resultInt2 funcInt = Seq.map3 funcInt { 1..8 } { 2..9 } { 3..10 }
let verify c = failwith "not implemented"
Seq.splitInto 4 {1..5} |> verify { 1.. 10 }
seq [ {1..4}; {5..7}; {8..10} ]
Seq.allPairs { 1..7 } Seq.empty
Seq.allPairs Seq.empty { 1..7 }
let intArr1 = [| yield! {1..100}
yield! {1..100} |]
Array.ofSeq {1..10}

Просмотреть файл

@ -1,7 +1,8 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
module Language.SequenceExpressionTests module Language.SequenceExpression.SequenceExpressionTests
open FSharp.Test
open Xunit open Xunit
open FSharp.Test.Compiler open FSharp.Test.Compiler
open FSharp.Test.ScriptHelpers open FSharp.Test.ScriptHelpers
@ -467,4 +468,125 @@ let f2 = return! [ 3; 4 ]
|> withDiagnostics [ |> withDiagnostics [
(Error 748, Line 2, Col 10, Line 2, Col 16, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'."); (Error 748, Line 2, Col 10, Line 2, Col 16, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.");
(Error 748, Line 3, Col 10, Line 3, Col 17, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.") (Error 748, Line 3, Col 10, Line 3, Col 17, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.")
] ]
[<Fact>]
let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version 9``() =
Fsx """
{ 1;10 }
[| { 1;10 } |]
let a = { 1;10 }
let b = [| { 1;10 } |]
let c = [ { 1;10 } ]
"""
|> withOptions [ "--nowarn:0020" ]
|> withLangVersion90
|> typecheck
|> shouldFail
|> withDiagnostics [
(Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
]
[<Fact>]
let ``Sequence(SynExpr.Sequential) expressions should be of the form 'seq { ... } lang version preview``() =
Fsx """
{ 1;10 }
[| { 1;10 } |]
let a = { 1;10 }
let b = [| { 1;10 } |]
let c = [ { 1;10 } ]
"""
|> withOptions [ "--nowarn:0020" ]
|> withLangVersionPreview
|> typecheck
|> shouldFail
|> withDiagnostics [
(Error 740, Line 2, Col 1, Line 2, Col 9, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 3, Col 4, Line 3, Col 12, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 4, Col 9, Line 4, Col 17, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 5, Col 12, Line 5, Col 20, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
(Error 740, Line 6, Col 11, Line 6, Col 19, "Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }'")
]
// SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_SequenceExpressions01.fs"|])>]
let ``E_SequenceExpressions01 lang version 9`` compilation =
compilation
|> withOptions [ "--nowarn:0020" ]
|> withLangVersion90
|> typecheck
|> shouldSucceed
// SOURCE=E_SequenceExpressions01.fs # E_SequenceExpressions01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"E_SequenceExpressions01.fs"|])>]
let ``E_SequenceExpressions01 lang version preview`` compilation =
compilation
|> withOptions [ "--nowarn:0020" ]
|> withLangVersionPreview
|> typecheck
|> shouldFail
|> withDiagnostics [
(Warning 3873, Line 1, Col 1, Line 1, Col 10, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 3, Col 1, Line 3, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 5, Col 4, Line 5, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 7, Col 4, Line 7, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 9, Col 9, Line 9, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 11, Col 10, Line 11, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 13, Col 12, Line 13, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 15, Col 13, Line 15, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 17, Col 11, Line 17, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 19, Col 4, Line 19, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 21, Col 10, Line 21, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 23, Col 3, Line 23, Col 12, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 25, Col 3, Line 25, Col 16, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 27, Col 9, Line 27, Col 18, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 29, Col 9, Line 29, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 31, Col 13, Line 31, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 33, Col 13, Line 33, Col 26, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 35, Col 34, Line 35, Col 51, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 37, Col 35, Line 37, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 39, Col 10, Line 39, Col 19, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 41, Col 10, Line 41, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 45, Col 12, Line 45, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 47, Col 13, Line 47, Col 25, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 49, Col 14, Line 49, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 51, Col 33, Line 51, Col 50, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 55, Col 12, Line 55, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 57, Col 1, Line 57, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 59, Col 28, Line 59, Col 34, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 61, Col 44, Line 61, Col 52, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 61, Col 53, Line 61, Col 61, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 61, Col 62, Line 61, Col 71, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 65, Col 17, Line 65, Col 23, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 65, Col 34, Line 65, Col 44, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 67, Col 7, Line 67, Col 13, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 67, Col 15, Line 67, Col 21, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 67, Col 23, Line 67, Col 30, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 69, Col 14, Line 69, Col 22, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 71, Col 24, Line 71, Col 32, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 73, Col 25, Line 73, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 74, Col 25, Line 74, Col 33, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
(Warning 3873, Line 76, Col 13, Line 76, Col 20, "This construct is deprecated. Sequence expressions should be of the form 'seq { ... }'")
]
// SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"SequenceExpressions01.fs"|])>]
let ``SequenceExpressions01 lang version 9`` compilation =
compilation
|> withOptions [ "--nowarn:0020" ]
|> withLangVersion90
|> typecheck
|> shouldSucceed
// SOURCE=SequenceExpressions01.fs # SequenceExpressions01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"SequenceExpressions01.fs"|])>]
let ``SequenceExpressions01 lang version preview`` compilation =
compilation
|> withOptions [ "--nowarn:0020" ]
|> withLangVersionPreview
|> typecheck
|> shouldSucceed

Просмотреть файл

@ -0,0 +1,76 @@
seq { 1..10 }
seq { 1..5..10 }
[| seq { 1..10 } |]
[| seq { 1..5..10 } |]
let a = seq { 1..10 }
let a3 = seq { 1..10..20 }
let b = [| seq { 1..10 } |]
let b3 = [| seq { 1..10..20 } |]
let c = [ seq { 1..10 } ]
[| seq { 1..10 } |]
[| yield seq { 1..10 } |]
[ seq { 1..10 } ]
[ seq { 1..10..10 } ]
[ yield seq { 1..10 } ]
[ yield seq { 1..10..20 } ]
ResizeArray(seq { 1..10 })
ResizeArray(seq { 1..10..20 })
let fw start finish = [ for x in seq { start..finish } -> x ]
let fe start finish = [| for x in seq { start..finish } -> x |]
for x in seq { 1..10 } do ()
for x in seq { 1..5..10 } do ()
let f = Seq.head
let a2 = f (seq { 1..6 })
let a23 = f (seq { 1..6..10 })
let b2 = set (seq { 1..6 })
let f10 start finish = for x in seq { start..finish } do ignore (float x ** float x)
let (..) _ _ = "lol"
let lol1 = seq { 1..10 }
seq { 1..5..10 }
let resultInt = Seq.length (seq {1..8})
let resultInt2 funcInt = Seq.map3 funcInt (seq { 1..8 }) (seq { 2..9 }) (seq { 3..10 })
let verify c = failwith "not implemented"
Seq.splitInto 4 (seq {1..5}) |> verify (seq { 1.. 10 })
seq [ seq {1..4}; seq {5..7}; seq {8..10} ]
Seq.allPairs (seq { 1..7 }) Seq.empty
Seq.allPairs Seq.empty (seq { 1..7 })
let intArr1 = [| yield! seq {1..100}
yield! seq {1..100} |]
Array.ofSeq (seq {1..10})

Просмотреть файл

@ -455,7 +455,7 @@ let r as _ = 10
let s as Id0 = 11 let s as Id0 = 11
let t as (u) = 12 let t as (u) = 12
let v as struct(w, x) = 13, 14 let v as struct(w, x) = 13, 14
let y as z : int = 15{set { 'a'..'x' } - set [ 'p'; 'v' ] |> Set.map (sprintf " + %c") |> System.String.Concat} let y as z : int = 15{set (seq { 'a'..'x' }) - set [ 'p'; 'v' ] |> Set.map (sprintf " + %c") |> System.String.Concat}
Some p |> eq<AAA> Some p |> eq<AAA>
Some v |> eq<struct(int * int)> Some v |> eq<struct(int * int)>
() ()
@ -590,7 +590,7 @@ let _ as r = 10
let Id0 as s = 11 let Id0 as s = 11
let (t) as u = 12 let (t) as u = 12
let struct(w, v) as x = 13, 14 let struct(w, v) as x = 13, 14
let (y : int) as z = 15{set { 'a'..'v' } - set [ 'h'; 'q' ] |> Set.map (sprintf " + %c") |> System.String.Concat} let (y : int) as z = 15{set (seq { 'a'..'v' }) - set [ 'h'; 'q' ] |> Set.map (sprintf " + %c") |> System.String.Concat}
Some h |> eq<int * int> Some h |> eq<int * int>
Some q |> eq<AAA> Some q |> eq<AAA>
Some x |> eq<struct(int * int)> Some x |> eq<struct(int * int)>
@ -917,7 +917,7 @@ let :? z as
[<FactForNETCOREAPP>] [<FactForNETCOREAPP>]
let ``As 16 - syntactical precedence matrix testing left with type tests - total patterns`` () = let ``As 16 - syntactical precedence matrix testing left with type tests - total patterns`` () =
let validSet = set { 'a'..'x' } - set [ 'p'; 'q' ] |> Set.map string let validSet = set (seq { 'a'..'x' }) - set [ 'p'; 'q' ] |> Set.map string
let _, checkResults = getParseAndCheckResults70 $""" let _, checkResults = getParseAndCheckResults70 $"""
let eq<'T> (x:'T option) = () // FS-1093-safe type assert function let eq<'T> (x:'T option) = () // FS-1093-safe type assert function
let (|Id0|) = ignore let (|Id0|) = ignore

Просмотреть файл

@ -259,8 +259,8 @@ type ArrayModule() =
[<Fact>] [<Fact>]
member _.Except() = member _.Except() =
// integer array // integer array
let intArr1 = [| yield! {1..100} let intArr1 = [| yield! seq {1..100}
yield! {1..100} |] yield! seq {1..100} |]
let intArr2 = [| 1 .. 10 |] let intArr2 = [| 1 .. 10 |]
let expectedIntArr = [| 11 .. 100 |] let expectedIntArr = [| 11 .. 100 |]

Просмотреть файл

@ -372,7 +372,7 @@ type ArrayModule2() =
[<Fact>] [<Fact>]
member this.Of_Seq() = member this.Of_Seq() =
// integer array // integer array
let resultInt = Array.ofSeq {1..10} let resultInt = Array.ofSeq (seq {1..10})
if resultInt <> [|1..10|] then Assert.Fail() if resultInt <> [|1..10|] then Assert.Fail()
// string array // string array

Просмотреть файл

@ -346,8 +346,8 @@ type ListModule() =
[<Fact>] [<Fact>]
member _.Except() = member _.Except() =
// integer list // integer list
let intList1 = [ yield! {1..100} let intList1 = [ yield! seq {1..100}
yield! {1..100} ] yield! seq {1..100} ]
let intList2 = [1..10] let intList2 = [1..10]
let expectedIntList = [11..100] let expectedIntList = [11..100]

Просмотреть файл

@ -367,7 +367,7 @@ type ListModule02() =
[<Fact>] [<Fact>]
member this.Of_Seq() = member this.Of_Seq() =
// integer List // integer List
let resultInt = List.ofSeq {1..10} let resultInt = List.ofSeq (seq {1..10})
Assert.AreEqual([1..10], resultInt) Assert.AreEqual([1..10], resultInt)
// string List // string List

Просмотреть файл

@ -15,14 +15,14 @@ type ObsoleteSeqFunctions() =
// Negative index // Negative index
for i = -1 downto -10 do for i = -1 downto -10 do
CheckThrowsArgumentException (fun () -> Seq.nth i { 10 .. 20 } |> ignore) CheckThrowsArgumentException (fun () -> Seq.nth i (seq { 10 .. 20 }) |> ignore)
// Out of range // Out of range
for i = 11 to 20 do for i = 11 to 20 do
CheckThrowsArgumentException (fun () -> Seq.nth i { 10 .. 20 } |> ignore) CheckThrowsArgumentException (fun () -> Seq.nth i (seq { 10 .. 20 }) |> ignore)
// integer Seq // integer Seq
let resultInt = Seq.nth 3 { 10..20 } let resultInt = Seq.nth 3 (seq { 10..20 })
Assert.AreEqual(13, resultInt) Assert.AreEqual(13, resultInt)
// string Seq // string Seq

Просмотреть файл

@ -39,8 +39,8 @@ type SeqModule() =
// empty Seq // empty Seq
VerifySeqsEqual Seq.empty <| Seq.allPairs Seq.empty Seq.empty VerifySeqsEqual Seq.empty <| Seq.allPairs Seq.empty Seq.empty
VerifySeqsEqual Seq.empty <| Seq.allPairs { 1..7 } Seq.empty VerifySeqsEqual Seq.empty <| Seq.allPairs (seq { 1..7 }) Seq.empty
VerifySeqsEqual Seq.empty <| Seq.allPairs Seq.empty { 1..7 } VerifySeqsEqual Seq.empty <| Seq.allPairs Seq.empty (seq { 1..7 })
// null Seq // null Seq
CheckThrowsArgumentNullException(fun() -> Seq.allPairs null null |> ignore) CheckThrowsArgumentNullException(fun() -> Seq.allPairs null null |> ignore)
@ -349,9 +349,9 @@ type SeqModule() =
|> Seq.iter ((<||) VerifySeqsEqual) |> Seq.iter ((<||) VerifySeqsEqual)
// int Seq // int Seq
verify [[1..4];[5..8]] <| Seq.chunkBySize 4 {1..8} verify [[1..4];[5..8]] <| Seq.chunkBySize 4 (seq {1..8})
verify [[1..4];[5..8];[9..10]] <| Seq.chunkBySize 4 {1..10} verify [[1..4];[5..8];[9..10]] <| Seq.chunkBySize 4 (seq {1..10})
verify [[1]; [2]; [3]; [4]] <| Seq.chunkBySize 1 {1..4} verify [[1]; [2]; [3]; [4]] <| Seq.chunkBySize 1 (seq {1..4})
Seq.chunkBySize 2 (Seq.initInfinite id) Seq.chunkBySize 2 (Seq.initInfinite id)
|> Seq.take 3 |> Seq.take 3
@ -372,8 +372,8 @@ type SeqModule() =
CheckThrowsArgumentNullException (fun () -> Seq.chunkBySize 3 nullSeq |> ignore) CheckThrowsArgumentNullException (fun () -> Seq.chunkBySize 3 nullSeq |> ignore)
// invalidArg // invalidArg
CheckThrowsArgumentException (fun () -> Seq.chunkBySize 0 {1..10} |> ignore) CheckThrowsArgumentException (fun () -> Seq.chunkBySize 0 (seq {1..10}) |> ignore)
CheckThrowsArgumentException (fun () -> Seq.chunkBySize -1 {1..10} |> ignore) CheckThrowsArgumentException (fun () -> Seq.chunkBySize -1 (seq {1..10}) |> ignore)
() ()
@ -385,12 +385,12 @@ type SeqModule() =
|> Seq.iter ((<||) VerifySeqsEqual) |> Seq.iter ((<||) VerifySeqsEqual)
// int Seq // int Seq
Seq.splitInto 3 {1..10} |> verify (seq [ {1..4}; {5..7}; {8..10} ]) Seq.splitInto 3 (seq {1..10}) |> verify (seq [ seq {1..4}; seq {5..7}; seq {8..10} ])
Seq.splitInto 3 {1..11} |> verify (seq [ {1..4}; {5..8}; {9..11} ]) Seq.splitInto 3 (seq {1..11}) |> verify (seq [ seq {1..4}; seq {5..8}; seq {9..11} ])
Seq.splitInto 3 {1..12} |> verify (seq [ {1..4}; {5..8}; {9..12} ]) Seq.splitInto 3 (seq {1..12}) |> verify (seq [ seq {1..4}; seq {5..8}; seq {9..12} ])
Seq.splitInto 4 {1..5} |> verify (seq [ [1..2]; [3]; [4]; [5] ]) Seq.splitInto 4 (seq {1..5}) |> verify (seq [ [1..2]; [3]; [4]; [5] ])
Seq.splitInto 20 {1..4} |> verify (seq [ [1]; [2]; [3]; [4] ]) Seq.splitInto 20 (seq {1..4}) |> verify (seq [ [1]; [2]; [3]; [4] ])
// string Seq // string Seq
Seq.splitInto 3 ["a";"b";"c";"d";"e"] |> verify ([ ["a"; "b"]; ["c";"d"]; ["e"] ]) Seq.splitInto 3 ["a";"b";"c";"d";"e"] |> verify ([ ["a"; "b"]; ["c";"d"]; ["e"] ])
@ -586,10 +586,10 @@ type SeqModule() =
[<Fact>] [<Fact>]
member _.Except() = member _.Except() =
// integer Seq // integer Seq
let intSeq1 = seq { yield! {1..100} let intSeq1 = seq { yield! seq {1..100}
yield! {1..100} } yield! seq {1..100} }
let intSeq2 = {1..10} let intSeq2 = seq {1..10}
let expectedIntSeq = {11..100} let expectedIntSeq = seq {11..100}
VerifySeqsEqual expectedIntSeq <| Seq.except intSeq2 intSeq1 VerifySeqsEqual expectedIntSeq <| Seq.except intSeq2 intSeq1
@ -609,7 +609,7 @@ type SeqModule() =
// empty Seq // empty Seq
let emptyIntSeq = Seq.empty<int> let emptyIntSeq = Seq.empty<int>
VerifySeqsEqual {1..100} <| Seq.except emptyIntSeq intSeq1 VerifySeqsEqual (seq {1..100}) <| Seq.except emptyIntSeq intSeq1
VerifySeqsEqual emptyIntSeq <| Seq.except intSeq1 emptyIntSeq VerifySeqsEqual emptyIntSeq <| Seq.except intSeq1 emptyIntSeq
VerifySeqsEqual emptyIntSeq <| Seq.except emptyIntSeq emptyIntSeq VerifySeqsEqual emptyIntSeq <| Seq.except emptyIntSeq emptyIntSeq
VerifySeqsEqual emptyIntSeq <| Seq.except intSeq1 intSeq1 VerifySeqsEqual emptyIntSeq <| Seq.except intSeq1 intSeq1

Просмотреть файл

@ -479,7 +479,7 @@ type SeqModule2() =
member _.Length() = member _.Length() =
// integer seq // integer seq
let resultInt = Seq.length {1..8} let resultInt = Seq.length (seq {1..8})
if resultInt <> 8 then Assert.Fail() if resultInt <> 8 then Assert.Fail()
// string Seq // string Seq
@ -505,7 +505,7 @@ type SeqModule2() =
| _ when x % 2 = 0 -> 10*x | _ when x % 2 = 0 -> 10*x
| _ -> x | _ -> x
let resultInt = Seq.map funcInt { 1..10 } let resultInt = Seq.map funcInt (seq { 1..10 })
let expectedint = seq [1;20;3;40;5;60;7;80;9;100] let expectedint = seq [1;20;3;40;5;60;7;80;9;100]
VerifySeqsEqual expectedint resultInt VerifySeqsEqual expectedint resultInt
@ -531,7 +531,7 @@ type SeqModule2() =
member _.Map2() = member _.Map2() =
// integer Seq // integer Seq
let funcInt x y = x+y let funcInt x y = x+y
let resultInt = Seq.map2 funcInt { 1..10 } {2..2..20} let resultInt = Seq.map2 funcInt (seq { 1..10 }) (seq {2..2..20})
let expectedint = seq [3;6;9;12;15;18;21;24;27;30] let expectedint = seq [3;6;9;12;15;18;21;24;27;30]
VerifySeqsEqual expectedint resultInt VerifySeqsEqual expectedint resultInt
@ -558,16 +558,16 @@ type SeqModule2() =
member _.Map3() = member _.Map3() =
// Integer seq // Integer seq
let funcInt a b c = (a + b) * c let funcInt a b c = (a + b) * c
let resultInt = Seq.map3 funcInt { 1..8 } { 2..9 } { 3..10 } let resultInt = Seq.map3 funcInt (seq { 1..8 }) (seq { 2..9 }) (seq { 3..10 })
let expectedInt = seq [9; 20; 35; 54; 77; 104; 135; 170] let expectedInt = seq [9; 20; 35; 54; 77; 104; 135; 170]
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
// First seq is shorter // First seq is shorter
VerifySeqsEqual (seq [9; 20]) (Seq.map3 funcInt { 1..2 } { 2..9 } { 3..10 }) VerifySeqsEqual (seq [9; 20]) (Seq.map3 funcInt (seq { 1..2 }) (seq { 2..9 }) (seq { 3..10 }))
// Second seq is shorter // Second seq is shorter
VerifySeqsEqual (seq [9; 20; 35]) (Seq.map3 funcInt { 1..8 } { 2..4 } { 3..10 }) VerifySeqsEqual (seq [9; 20; 35]) (Seq.map3 funcInt (seq { 1..8 }) (seq { 2..4 }) (seq { 3..10 }))
// Third seq is shorter // Third seq is shorter
VerifySeqsEqual (seq [9; 20; 35; 54]) (Seq.map3 funcInt { 1..8 } { 2..6 } { 3..6 }) VerifySeqsEqual (seq [9; 20; 35; 54]) (Seq.map3 funcInt (seq { 1..8 }) (seq { 2..6 }) (seq { 3..6 }))
// String seq // String seq
let funcStr a b c = a + b + c let funcStr a b c = a + b + c
@ -812,7 +812,7 @@ type SeqModule2() =
member _.Collect() = member _.Collect() =
// integer Seq // integer Seq
let funcInt x = seq [x+1] let funcInt x = seq [x+1]
let resultInt = Seq.collect funcInt { 1..10 } let resultInt = Seq.collect funcInt (seq { 1..10 })
let expectedint = seq {2..11} let expectedint = seq {2..11}
@ -843,7 +843,7 @@ type SeqModule2() =
// integer Seq // integer Seq
let funcInt x y = x+y let funcInt x y = x+y
let resultInt = Seq.mapi funcInt { 10..2..20 } let resultInt = Seq.mapi funcInt (seq { 10..2..20 })
let expectedint = seq [10;13;16;19;22;25] let expectedint = seq [10;13;16;19;22;25]
VerifySeqsEqual expectedint resultInt VerifySeqsEqual expectedint resultInt
@ -871,7 +871,7 @@ type SeqModule2() =
member _.Mapi2() = member _.Mapi2() =
// integer Seq // integer Seq
let funcInt x y z = x+y+z let funcInt x y z = x+y+z
let resultInt = Seq.mapi2 funcInt { 1..10 } {2..2..20} let resultInt = Seq.mapi2 funcInt (seq { 1..10 }) (seq {2..2..20})
let expectedint = seq [3;7;11;15;19;23;27;31;35;39] let expectedint = seq [3;7;11;15;19;23;27;31;35;39]
VerifySeqsEqual expectedint resultInt VerifySeqsEqual expectedint resultInt
@ -907,7 +907,7 @@ type SeqModule2() =
member _.Indexed() = member _.Indexed() =
// integer Seq // integer Seq
let resultInt = Seq.indexed { 10..2..20 } let resultInt = Seq.indexed (seq { 10..2..20 })
let expectedint = seq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)] let expectedint = seq [(0,10);(1,12);(2,14);(3,16);(4,18);(5,20)]
VerifySeqsEqual expectedint resultInt VerifySeqsEqual expectedint resultInt
@ -931,7 +931,7 @@ type SeqModule2() =
[<Fact>] [<Fact>]
member _.Max() = member _.Max() =
// integer Seq // integer Seq
let resultInt = Seq.max { 10..20 } let resultInt = Seq.max (seq { 10..20 })
Assert.AreEqual(20,resultInt) Assert.AreEqual(20,resultInt)
@ -954,7 +954,7 @@ type SeqModule2() =
// integer Seq // integer Seq
let funcInt x = x % 8 let funcInt x = x % 8
let resultInt = Seq.maxBy funcInt { 2..2..20 } let resultInt = Seq.maxBy funcInt (seq { 2..2..20 })
Assert.AreEqual(6,resultInt) Assert.AreEqual(6,resultInt)
// string Seq // string Seq
@ -976,7 +976,7 @@ type SeqModule2() =
// integer Seq // integer Seq
let funcInt x = x % 8 let funcInt x = x % 8
let resultInt = Seq.minBy funcInt { 2..2..20 } let resultInt = Seq.minBy funcInt (seq { 2..2..20 })
Assert.AreEqual(8,resultInt) Assert.AreEqual(8,resultInt)
// string Seq // string Seq
@ -998,7 +998,7 @@ type SeqModule2() =
member _.Min() = member _.Min() =
// integer Seq // integer Seq
let resultInt = Seq.min { 10..20 } let resultInt = Seq.min (seq { 10..20 })
Assert.AreEqual(10,resultInt) Assert.AreEqual(10,resultInt)
// string Seq // string Seq
@ -1017,7 +1017,7 @@ type SeqModule2() =
[<Fact>] [<Fact>]
member _.Item() = member _.Item() =
// integer Seq // integer Seq
let resultInt = Seq.item 3 { 10..20 } let resultInt = Seq.item 3 (seq { 10..20 })
Assert.AreEqual(13, resultInt) Assert.AreEqual(13, resultInt)
// string Seq // string Seq
@ -1033,11 +1033,11 @@ type SeqModule2() =
// Negative index // Negative index
for i = -1 downto -10 do for i = -1 downto -10 do
CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) CheckThrowsArgumentException (fun () -> Seq.item i (seq { 10 .. 20 }) |> ignore)
// Out of range // Out of range
for i = 11 to 20 do for i = 11 to 20 do
CheckThrowsArgumentException (fun () -> Seq.item i { 10 .. 20 } |> ignore) CheckThrowsArgumentException (fun () -> Seq.item i (seq { 10 .. 20 }) |> ignore)
[<Fact>] [<Fact>]
member _.``item should fail with correct number of missing elements``() = member _.``item should fail with correct number of missing elements``() =
@ -1057,7 +1057,7 @@ type SeqModule2() =
member _.Of_Array() = member _.Of_Array() =
// integer Seq // integer Seq
let resultInt = Seq.ofArray [|1..10|] let resultInt = Seq.ofArray [|1..10|]
let expectedInt = {1..10} let expectedInt = seq {1..10}
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
@ -1076,7 +1076,7 @@ type SeqModule2() =
member _.Of_List() = member _.Of_List() =
// integer Seq // integer Seq
let resultInt = Seq.ofList [1..10] let resultInt = Seq.ofList [1..10]
let expectedInt = {1..10} let expectedInt = seq {1..10}
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
@ -1095,7 +1095,7 @@ type SeqModule2() =
[<Fact>] [<Fact>]
member _.Pairwise() = member _.Pairwise() =
// integer Seq // integer Seq
let resultInt = Seq.pairwise {1..3} let resultInt = Seq.pairwise (seq {1..3})
let expectedInt = seq [1,2;2,3] let expectedInt = seq [1,2;2,3]
@ -1182,7 +1182,7 @@ type SeqModule2() =
member _.Scan() = member _.Scan() =
// integer Seq // integer Seq
let funcInt x y = x+y let funcInt x y = x+y
let resultInt = Seq.scan funcInt 9 {1..10} let resultInt = Seq.scan funcInt 9 (seq {1..10})
let expectedInt = seq [9;10;12;15;19;24;30;37;45;54;64] let expectedInt = seq [9;10;12;15;19;24;30;37;45;54;64]
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
@ -1207,7 +1207,7 @@ type SeqModule2() =
member _.ScanBack() = member _.ScanBack() =
// integer Seq // integer Seq
let funcInt x y = x+y let funcInt x y = x+y
let resultInt = Seq.scanBack funcInt { 1..10 } 9 let resultInt = Seq.scanBack funcInt (seq { 1..10 }) 9
let expectedInt = seq [64;63;61;58;54;49;43;36;28;19;9] let expectedInt = seq [64;63;61;58;54;49;43;36;28;19;9]
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
@ -1313,7 +1313,7 @@ type SeqModule2() =
// integer Seq // integer Seq
let resultInt = Seq.sort (seq [1;3;2;4;6;5;7]) let resultInt = Seq.sort (seq [1;3;2;4;6;5;7])
let expectedInt = {1..7} let expectedInt = seq {1..7}
VerifySeqsEqual expectedInt resultInt VerifySeqsEqual expectedInt resultInt
// string Seq // string Seq
@ -1960,7 +1960,7 @@ type SeqModule2() =
[<Fact>] [<Fact>]
member _.tryItem() = member _.tryItem() =
// integer Seq // integer Seq
let resultInt = Seq.tryItem 3 { 10..20 } let resultInt = Seq.tryItem 3 (seq { 10..20 })
Assert.AreEqual(Some(13), resultInt) Assert.AreEqual(Some(13), resultInt)
// string Seq // string Seq
@ -1976,11 +1976,11 @@ type SeqModule2() =
CheckThrowsArgumentNullException (fun () -> Seq.tryItem 3 nullSeq |> ignore) CheckThrowsArgumentNullException (fun () -> Seq.tryItem 3 nullSeq |> ignore)
// Negative index // Negative index
let resultNegativeIndex = Seq.tryItem -1 { 10..20 } let resultNegativeIndex = Seq.tryItem -1 (seq { 10..20 })
Assert.AreEqual(None, resultNegativeIndex) Assert.AreEqual(None, resultNegativeIndex)
// Index greater than length // Index greater than length
let resultIndexGreater = Seq.tryItem 31 { 10..20 } let resultIndexGreater = Seq.tryItem 31 (seq { 10..20 })
Assert.AreEqual(None, resultIndexGreater) Assert.AreEqual(None, resultIndexGreater)
[<Fact>] [<Fact>]

Просмотреть файл

@ -821,7 +821,7 @@ module internal RangeTestsHelpers =
enumerator.Current |> ignore enumerator.Current |> ignore
let inline exceptions zero one two = let inline exceptions zero one two =
Assert.Throws (typeof<System.ArgumentException>, (fun () -> {one .. zero .. two} |> Seq.length |> ignore)) |> ignore Assert.Throws (typeof<System.ArgumentException>, (fun () -> seq {one .. zero .. two} |> Seq.length |> ignore)) |> ignore
Assert.Throws (typeof<System.ArgumentException>, (fun () -> [one .. zero .. two] |> List.length |> ignore)) |> ignore Assert.Throws (typeof<System.ArgumentException>, (fun () -> [one .. zero .. two] |> List.length |> ignore)) |> ignore
Assert.Throws (typeof<System.ArgumentException>, (fun () -> [|one .. zero .. two|] |> Array.length |> ignore)) |> ignore Assert.Throws (typeof<System.ArgumentException>, (fun () -> [|one .. zero .. two|] |> Array.length |> ignore)) |> ignore
@ -831,10 +831,10 @@ module internal RangeTestsHelpers =
Assert.Throws (typeof<System.InvalidOperationException>, (fun () -> regressionExceptionAfterEndVariableStepIntegralRange zero two)) |> ignore Assert.Throws (typeof<System.InvalidOperationException>, (fun () -> regressionExceptionAfterEndVariableStepIntegralRange zero two)) |> ignore
let inline common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) = let inline common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) =
Assert.AreEqual (seq {yield min0; yield min1; yield min2; yield min3}, {min0 .. min3}) Assert.AreEqual (seq {yield min0; yield min1; yield min2; yield min3}, seq {min0 .. min3})
Assert.AreEqual (seq {min0; min1; min2; min3}, {min0 .. one .. min3}) Assert.AreEqual (seq {min0; min1; min2; min3}, seq {min0 .. one .. min3})
Assert.AreEqual (seq {min0; min2}, {min0 .. two .. min3}) Assert.AreEqual (seq {min0; min2}, seq {min0 .. two .. min3})
Assert.AreEqual (seq {min0; min3}, {min0 .. three .. min3}) Assert.AreEqual (seq {min0; min3}, seq {min0 .. three .. min3})
Assert.AreEqual ([min0; min1; min2; min3], [min0 .. min3]) Assert.AreEqual ([min0; min1; min2; min3], [min0 .. min3])
Assert.AreEqual ([min0; min1; min2; min3], [min0 .. one .. min3]) Assert.AreEqual ([min0; min1; min2; min3], [min0 .. one .. min3])
@ -846,10 +846,10 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([|min0; min2|], [|min0 .. two .. min3|]) Assert.AreEqual ([|min0; min2|], [|min0 .. two .. min3|])
Assert.AreEqual ([|min0; min3|], [|min0 .. three .. min3|]) Assert.AreEqual ([|min0; min3|], [|min0 .. three .. min3|])
Assert.AreEqual (seq {yield max3; yield max2; yield max1; yield max0}, {max3 .. max0}) Assert.AreEqual (seq {yield max3; yield max2; yield max1; yield max0}, seq {max3 .. max0})
Assert.AreEqual (seq {max3; max2; max1; max0}, {max3 .. one .. max0}) Assert.AreEqual (seq {max3; max2; max1; max0}, seq {max3 .. one .. max0})
Assert.AreEqual (seq {max3; max1}, {max3 .. two .. max0}) Assert.AreEqual (seq {max3; max1}, seq {max3 .. two .. max0})
Assert.AreEqual (seq {max3; max0}, {max3 .. three .. max0}) Assert.AreEqual (seq {max3; max0}, seq {max3 .. three .. max0})
Assert.AreEqual ([max3; max2; max1; max0], [max3 .. max0]) Assert.AreEqual ([max3; max2; max1; max0], [max3 .. max0])
Assert.AreEqual ([max3; max2; max1; max0], [max3 .. one .. max0]) Assert.AreEqual ([max3; max2; max1; max0], [max3 .. one .. max0])
@ -861,10 +861,10 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([|max3; max1|], [|max3 .. two .. max0|]) Assert.AreEqual ([|max3; max1|], [|max3 .. two .. max0|])
Assert.AreEqual ([|max3; max0|], [|max3 .. three .. max0|]) Assert.AreEqual ([|max3; max0|], [|max3 .. three .. max0|])
Assert.AreEqual (Seq.empty, {max0 .. min0}) Assert.AreEqual (Seq.empty, seq {max0 .. min0})
Assert.AreEqual (Seq.empty, {max0 .. one .. min0}) Assert.AreEqual (Seq.empty, seq {max0 .. one .. min0})
Assert.AreEqual (Seq.empty, {max0 .. two .. min0}) Assert.AreEqual (Seq.empty, seq {max0 .. two .. min0})
Assert.AreEqual (Seq.empty, {max0 .. three .. min0}) Assert.AreEqual (Seq.empty, seq {max0 .. three .. min0})
Assert.AreEqual ([], [max0 .. min0]) Assert.AreEqual ([], [max0 .. min0])
Assert.AreEqual ([], [max0 .. one .. min0]) Assert.AreEqual ([], [max0 .. one .. min0])
@ -880,8 +880,8 @@ module internal RangeTestsHelpers =
// tests for singleStepRangeEnumerator, as it only is used if start and/or end are not the // tests for singleStepRangeEnumerator, as it only is used if start and/or end are not the
// minimum or maximum of the number range and it is counting by 1s // minimum or maximum of the number range and it is counting by 1s
Assert.AreEqual (seq {min1; min2; min3}, {min1 .. min3}) Assert.AreEqual (seq {min1; min2; min3}, seq {min1 .. min3})
Assert.AreEqual (seq {max3; max2; max1}, {max3 .. max1}) Assert.AreEqual (seq {max3; max2; max1}, seq {max3 .. max1})
Assert.AreEqual ([min1; min2; min3], [min1 .. min3]) Assert.AreEqual ([min1; min2; min3], [min1 .. min3])
Assert.AreEqual ([max3; max2; max1], [max3 .. max1]) Assert.AreEqual ([max3; max2; max1], [max3 .. max1])
@ -903,10 +903,10 @@ module internal RangeTestsHelpers =
common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three)
Assert.AreEqual (seq { min0; min0 + max0; min0 + max0 + max0 }, {min0 .. max0 .. max0}) Assert.AreEqual (seq { min0; min0 + max0; min0 + max0 + max0 }, seq {min0 .. max0 .. max0})
Assert.AreEqual (seq { min0; min0 + max1; min0 + max1 + max1 }, {min0 .. max1 .. max0}) Assert.AreEqual (seq { min0; min0 + max1; min0 + max1 + max1 }, seq {min0 .. max1 .. max0})
Assert.AreEqual (seq { min0; min0 + max2; min0 + max2 + max2 }, {min0 .. max2 .. max0}) Assert.AreEqual (seq { min0; min0 + max2; min0 + max2 + max2 }, seq {min0 .. max2 .. max0})
Assert.AreEqual (seq { min0; min0 + max3; min0 + max3 + max3 }, {min0 .. max3 .. max0}) Assert.AreEqual (seq { min0; min0 + max3; min0 + max3 + max3 }, seq {min0 .. max3 .. max0})
Assert.AreEqual ([ min0; min0 + max0; min0 + max0 + max0 ], [min0 .. max0 .. max0]) Assert.AreEqual ([ min0; min0 + max0; min0 + max0 + max0 ], [min0 .. max0 .. max0])
Assert.AreEqual ([ min0; min0 + max1; min0 + max1 + max1 ], [min0 .. max1 .. max0]) Assert.AreEqual ([ min0; min0 + max1; min0 + max1 + max1 ], [min0 .. max1 .. max0])
@ -918,9 +918,9 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([| min0; min0 + max2; min0 + max2 + max2 |], [|min0 .. max2 .. max0|]) Assert.AreEqual ([| min0; min0 + max2; min0 + max2 + max2 |], [|min0 .. max2 .. max0|])
Assert.AreEqual ([| min0; min0 + max3; min0 + max3 + max3 |], [|min0 .. max3 .. max0|]) Assert.AreEqual ([| min0; min0 + max3; min0 + max3 + max3 |], [|min0 .. max3 .. max0|])
Assert.AreEqual (seq {min3; min2; min1; min0}, {min3 .. -one .. min0}) Assert.AreEqual (seq {min3; min2; min1; min0}, seq {min3 .. -one .. min0})
Assert.AreEqual (seq {min3; min1}, {min3 .. -two .. min0}) Assert.AreEqual (seq {min3; min1}, seq {min3 .. -two .. min0})
Assert.AreEqual (seq {min3; min0}, {min3 .. -three .. min0}) Assert.AreEqual (seq {min3; min0}, seq {min3 .. -three .. min0})
Assert.AreEqual ([min3; min2; min1; min0], [min3 .. -one .. min0]) Assert.AreEqual ([min3; min2; min1; min0], [min3 .. -one .. min0])
Assert.AreEqual ([min3; min1], [min3 .. -two .. min0]) Assert.AreEqual ([min3; min1], [min3 .. -two .. min0])
@ -930,9 +930,9 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([|min3; min1|], [|min3 .. -two .. min0|]) Assert.AreEqual ([|min3; min1|], [|min3 .. -two .. min0|])
Assert.AreEqual ([|min3; min0|], [|min3 .. -three .. min0|]) Assert.AreEqual ([|min3; min0|], [|min3 .. -three .. min0|])
Assert.AreEqual (seq {max0; max1; max2; max3}, {max0 .. -one .. max3}) Assert.AreEqual (seq {max0; max1; max2; max3}, seq {max0 .. -one .. max3})
Assert.AreEqual (seq {max0; max2}, {max0 .. -two .. max3}) Assert.AreEqual (seq {max0; max2}, seq {max0 .. -two .. max3})
Assert.AreEqual (seq {max0; max3}, {max0 .. -three .. max3}) Assert.AreEqual (seq {max0; max3}, seq {max0 .. -three .. max3})
Assert.AreEqual ([max0; max1; max2; max3], [max0 .. -one .. max3]) Assert.AreEqual ([max0; max1; max2; max3], [max0 .. -one .. max3])
Assert.AreEqual ([max0; max2], [max0 .. -two .. max3]) Assert.AreEqual ([max0; max2], [max0 .. -two .. max3])
@ -942,9 +942,9 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([|max0; max2|], [|max0 .. -two .. max3|]) Assert.AreEqual ([|max0; max2|], [|max0 .. -two .. max3|])
Assert.AreEqual ([|max0; max3|], [|max0 .. -three .. max3|]) Assert.AreEqual ([|max0; max3|], [|max0 .. -three .. max3|])
Assert.AreEqual (Seq.empty, {min0 .. -one .. max0}) Assert.AreEqual (Seq.empty, seq {min0 .. -one .. max0})
Assert.AreEqual (Seq.empty, {min0 .. -two .. max0}) Assert.AreEqual (Seq.empty, seq {min0 .. -two .. max0})
Assert.AreEqual (Seq.empty, {min0 .. -three .. max0}) Assert.AreEqual (Seq.empty, seq {min0 .. -three .. max0})
Assert.AreEqual ([], [min0 .. -one .. max0]) Assert.AreEqual ([], [min0 .. -one .. max0])
Assert.AreEqual ([], [min0 .. -two .. max0]) Assert.AreEqual ([], [min0 .. -two .. max0])
@ -954,10 +954,10 @@ module internal RangeTestsHelpers =
Assert.AreEqual ([||], [|min0 .. -two .. max0|]) Assert.AreEqual ([||], [|min0 .. -two .. max0|])
Assert.AreEqual ([||], [|min0 .. -three .. max0|]) Assert.AreEqual ([||], [|min0 .. -three .. max0|])
Assert.AreEqual (seq {max0; max0 + min0}, {max0 .. min0 .. min0}) Assert.AreEqual (seq {max0; max0 + min0}, seq {max0 .. min0 .. min0})
Assert.AreEqual (seq {max0; max0 + min1; max0 + min1 + min1 }, {max0 .. min1 .. min0}) Assert.AreEqual (seq {max0; max0 + min1; max0 + min1 + min1 }, seq {max0 .. min1 .. min0})
Assert.AreEqual (seq {max0; max0 + min2; max0 + min2 + min2 }, {max0 .. min2 .. min0}) Assert.AreEqual (seq {max0; max0 + min2; max0 + min2 + min2 }, seq {max0 .. min2 .. min0})
Assert.AreEqual (seq {max0; max0 + min3; max0 + min3 + min3 }, {max0 .. min3 .. min0}) Assert.AreEqual (seq {max0; max0 + min3; max0 + min3 + min3 }, seq {max0 .. min3 .. min0})
Assert.AreEqual ([max0; max0 + min0], [max0 .. min0 .. min0]) Assert.AreEqual ([max0; max0 + min0], [max0 .. min0 .. min0])
Assert.AreEqual ([max0; max0 + min1; max0 + min1 + min1 ], [max0 .. min1 .. min0]) Assert.AreEqual ([max0; max0 + min1; max0 + min1 + min1 ], [max0 .. min1 .. min0])
@ -983,10 +983,10 @@ module internal RangeTestsHelpers =
common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three)
Assert.AreEqual (seq {yield min0; yield min0 + max0}, {min0 .. max0 .. max0}) Assert.AreEqual (seq {yield min0; yield min0 + max0}, seq {min0 .. max0 .. max0})
Assert.AreEqual (seq {min0; min0 + max1}, {min0 .. max1 .. max0}) Assert.AreEqual (seq {min0; min0 + max1}, seq {min0 .. max1 .. max0})
Assert.AreEqual (seq {min0; min0 + max2}, {min0 .. max2 .. max0}) Assert.AreEqual (seq {min0; min0 + max2}, seq {min0 .. max2 .. max0})
Assert.AreEqual (seq {min0; min0 + max3}, {min0 .. max3 .. max0}) Assert.AreEqual (seq {min0; min0 + max3}, seq {min0 .. max3 .. max0})
Assert.AreEqual ([min0; min0 + max0], [min0 .. max0 .. max0]) Assert.AreEqual ([min0; min0 + max0], [min0 .. max0 .. max0])
Assert.AreEqual ([min0; min0 + max1], [min0 .. max1 .. max0]) Assert.AreEqual ([min0; min0 + max1], [min0 .. max1 .. max0])
@ -1064,15 +1064,15 @@ module RangeTests =
Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MinValue..1y..System.SByte.MaxValue do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MinValue..1y..System.SByte.MaxValue do c <- c + 1 done; c)
Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MaxValue .. -1y .. System.SByte.MinValue do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MaxValue .. -1y .. System.SByte.MinValue do c <- c + 1 done; c)
Assert.AreEqual(allSBytesSeq, {System.SByte.MinValue..System.SByte.MaxValue}) Assert.AreEqual(allSBytesSeq, seq {System.SByte.MinValue..System.SByte.MaxValue})
Assert.AreEqual(allSBytesList, [System.SByte.MinValue..System.SByte.MaxValue]) Assert.AreEqual(allSBytesList, [System.SByte.MinValue..System.SByte.MaxValue])
Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..System.SByte.MaxValue|]) Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..System.SByte.MaxValue|])
Assert.AreEqual(allSBytesSeq, {System.SByte.MinValue..1y..System.SByte.MaxValue}) Assert.AreEqual(allSBytesSeq, seq {System.SByte.MinValue..1y..System.SByte.MaxValue})
Assert.AreEqual(allSBytesList, [System.SByte.MinValue..1y..System.SByte.MaxValue]) Assert.AreEqual(allSBytesList, [System.SByte.MinValue..1y..System.SByte.MaxValue])
Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..1y..System.SByte.MaxValue|]) Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..1y..System.SByte.MaxValue|])
Assert.AreEqual(Seq.rev allSBytesSeq, {System.SByte.MaxValue .. -1y .. System.SByte.MinValue}) Assert.AreEqual(Seq.rev allSBytesSeq, seq {System.SByte.MaxValue .. -1y .. System.SByte.MinValue})
Assert.AreEqual(List.rev allSBytesList, [System.SByte.MaxValue .. -1y .. System.SByte.MinValue]) Assert.AreEqual(List.rev allSBytesList, [System.SByte.MaxValue .. -1y .. System.SByte.MinValue])
Assert.AreEqual(Array.rev allSBytesArray, [|System.SByte.MaxValue .. -1y .. System.SByte.MinValue|]) Assert.AreEqual(Array.rev allSBytesArray, [|System.SByte.MaxValue .. -1y .. System.SByte.MinValue|])
@ -1083,11 +1083,11 @@ module RangeTests =
Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..System.Byte.MaxValue do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..System.Byte.MaxValue do c <- c + 1 done; c)
Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..1uy..System.Byte.MaxValue do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..1uy..System.Byte.MaxValue do c <- c + 1 done; c)
Assert.AreEqual(allBytesSeq, {System.Byte.MinValue..System.Byte.MaxValue}) Assert.AreEqual(allBytesSeq, seq {System.Byte.MinValue..System.Byte.MaxValue})
Assert.AreEqual(allBytesList, [System.Byte.MinValue..System.Byte.MaxValue]) Assert.AreEqual(allBytesList, [System.Byte.MinValue..System.Byte.MaxValue])
Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..System.Byte.MaxValue|]) Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..System.Byte.MaxValue|])
Assert.AreEqual(allBytesSeq, {System.Byte.MinValue..1uy..System.Byte.MaxValue}) Assert.AreEqual(allBytesSeq, seq {System.Byte.MinValue..1uy..System.Byte.MaxValue})
Assert.AreEqual(allBytesList, [System.Byte.MinValue..1uy..System.Byte.MaxValue]) Assert.AreEqual(allBytesList, [System.Byte.MinValue..1uy..System.Byte.MaxValue])
Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..1uy..System.Byte.MaxValue|]) Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..1uy..System.Byte.MaxValue|])
@ -1141,15 +1141,15 @@ module RangeTests =
Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c)
Assert.AreEqual(256, let mutable c = 0 in for _ in max0 .. -one .. min0 do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in max0 .. -one .. min0 do c <- c + 1 done; c)
Assert.AreEqual(allSBytesSeq, {min0..max0}) Assert.AreEqual(allSBytesSeq, seq {min0..max0})
Assert.AreEqual(allSBytesList, [min0..max0]) Assert.AreEqual(allSBytesList, [min0..max0])
Assert.AreEqual(allSBytesArray, [|min0..max0|]) Assert.AreEqual(allSBytesArray, [|min0..max0|])
Assert.AreEqual(allSBytesSeq, {min0..one..max0}) Assert.AreEqual(allSBytesSeq, seq {min0..one..max0})
Assert.AreEqual(allSBytesList, [min0..one..max0]) Assert.AreEqual(allSBytesList, [min0..one..max0])
Assert.AreEqual(allSBytesArray, [|min0..one..max0|]) Assert.AreEqual(allSBytesArray, [|min0..one..max0|])
Assert.AreEqual(Seq.rev allSBytesSeq, {max0 .. -one .. min0}) Assert.AreEqual(Seq.rev allSBytesSeq, seq {max0 .. -one .. min0})
Assert.AreEqual(List.rev allSBytesList, [max0 .. -one .. min0]) Assert.AreEqual(List.rev allSBytesList, [max0 .. -one .. min0])
Assert.AreEqual(Array.rev allSBytesArray, [|max0 .. -one .. min0|]) Assert.AreEqual(Array.rev allSBytesArray, [|max0 .. -one .. min0|])
@ -1160,11 +1160,11 @@ module RangeTests =
Assert.AreEqual(256, let mutable c = 0 in for _ in min0..max0 do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in min0..max0 do c <- c + 1 done; c)
Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c) Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c)
Assert.AreEqual(allBytesSeq, {min0..max0}) Assert.AreEqual(allBytesSeq, seq {min0..max0})
Assert.AreEqual(allBytesList, [min0..max0]) Assert.AreEqual(allBytesList, [min0..max0])
Assert.AreEqual(allBytesArray, [|min0..max0|]) Assert.AreEqual(allBytesArray, [|min0..max0|])
Assert.AreEqual(allBytesSeq, {min0..one..max0}) Assert.AreEqual(allBytesSeq, seq {min0..one..max0})
Assert.AreEqual(allBytesList, [min0..one..max0]) Assert.AreEqual(allBytesList, [min0..one..max0])
Assert.AreEqual(allBytesArray, [|min0..one..max0|]) Assert.AreEqual(allBytesArray, [|min0..one..max0|])

Просмотреть файл

@ -72,7 +72,7 @@ module private Impl =
let ub = a1.GetUpperBound(0) let ub = a1.GetUpperBound(0)
if lb <> a2.GetLowerBound(0) || ub <> a2.GetUpperBound(0) then false if lb <> a2.GetLowerBound(0) || ub <> a2.GetUpperBound(0) then false
else else
{lb..ub} |> Seq.forall(fun i -> equals (a1.GetValue(i)) (a2.GetValue(i))) seq {lb..ub} |> Seq.forall(fun i -> equals (a1.GetValue(i)) (a2.GetValue(i)))
| _ -> | _ ->
Object.Equals(expected, actual) Object.Equals(expected, actual)

Просмотреть файл

@ -0,0 +1,77 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Microsoft.VisualStudio.FSharp.Editor
open System.Collections.Immutable
open System.Composition
open FSharp.Compiler.Syntax
open FSharp.Compiler.Text
open Microsoft.CodeAnalysis.CodeFixes
open Microsoft.CodeAnalysis.Text
open CancellableTasks
[<Sealed>]
[<ExportCodeFixProvider(FSharpConstants.FSharpLanguageName, Name = CodeFix.ChangeToUpcast); Shared>]
type internal AddMissingSeqCodeFixProvider() =
inherit CodeFixProvider()
static let title = SR.AddMissingSeq()
static let fixableDiagnosticIds = ImmutableArray.Create("FS3873", "FS0740")
override _.FixableDiagnosticIds = fixableDiagnosticIds
override this.RegisterCodeFixesAsync context = context.RegisterFsharpFix this
override this.GetFixAllProvider() = this.RegisterFsharpFixAll()
interface IFSharpCodeFixProvider with
member _.GetCodeFixIfAppliesAsync context =
cancellableTask {
let! sourceText = context.GetSourceTextAsync()
let! parseFileResults = context.Document.GetFSharpParseResultsAsync(nameof AddMissingSeqCodeFixProvider)
let getSourceLineStr line =
sourceText.Lines[Line.toZ line].ToString()
let range =
RoslynHelpers.TextSpanToFSharpRange(context.Document.FilePath, context.Span, sourceText)
let needsParens =
(range.Start, parseFileResults.ParseTree)
||> ParsedInput.exists (fun path node ->
match path, node with
| SyntaxNode.SynExpr outer :: _, SyntaxNode.SynExpr(expr & SynExpr.ComputationExpr _) when
expr.Range |> Range.equals range
->
let seqRange =
range
|> Range.withEnd (Position.mkPos range.Start.Line (range.Start.Column + 3))
let inner =
SynExpr.App(
ExprAtomicFlag.NonAtomic,
false,
SynExpr.Ident(Ident(nameof seq, seqRange)),
expr,
Range.unionRanges seqRange expr.Range
)
let outer =
match outer with
| SynExpr.App(flag, isInfix, funcExpr, _, outerAppRange) ->
SynExpr.App(flag, isInfix, funcExpr, inner, outerAppRange)
| outer -> outer
inner
|> SynExpr.shouldBeParenthesizedInContext getSourceLineStr (SyntaxNode.SynExpr outer :: path)
| _ -> false)
let text = sourceText.ToString(TextSpan(context.Span.Start, context.Span.Length))
let newText = if needsParens then $"(seq {text})" else $"seq {text}"
return
ValueSome
{
Name = CodeFix.AddMissingSeq
Message = title
Changes = [ TextChange(context.Span, newText) ]
}
}

Просмотреть файл

@ -208,3 +208,6 @@ module internal CodeFix =
[<Literal>] [<Literal>]
let RemoveUnnecessaryParentheses = "RemoveUnnecessaryParentheses" let RemoveUnnecessaryParentheses = "RemoveUnnecessaryParentheses"
[<Literal>]
let AddMissingSeq = "AddMissingSeq"

Просмотреть файл

@ -141,6 +141,7 @@
<Compile Include="CodeFixes\RenameParamToMatchSignature.fs" /> <Compile Include="CodeFixes\RenameParamToMatchSignature.fs" />
<Compile Include="CodeFixes\UseTripleQuotedInterpolation.fs" /> <Compile Include="CodeFixes\UseTripleQuotedInterpolation.fs" />
<Compile Include="CodeFixes\RemoveUnnecessaryParentheses.fs" /> <Compile Include="CodeFixes\RemoveUnnecessaryParentheses.fs" />
<Compile Include="CodeFixes\AddMissingSeq.fs" />
<Compile Include="Build\SetGlobalPropertiesForSdkProjects.fs" /> <Compile Include="Build\SetGlobalPropertiesForSdkProjects.fs" />
<Compile Include="AutomaticCompletion\BraceCompletionSessionProvider.fsi" /> <Compile Include="AutomaticCompletion\BraceCompletionSessionProvider.fsi" />
<Compile Include="AutomaticCompletion\BraceCompletionSessionProvider.fs" /> <Compile Include="AutomaticCompletion\BraceCompletionSessionProvider.fs" />

Просмотреть файл

@ -359,6 +359,9 @@ Use live (unsaved) buffers for analysis</value>
<data name="RemoveUnnecessaryParentheses" xml:space="preserve"> <data name="RemoveUnnecessaryParentheses" xml:space="preserve">
<value>Remove unnecessary parentheses</value> <value>Remove unnecessary parentheses</value>
</data> </data>
<data name="AddMissingSeq" xml:space="preserve">
<value>Add missing 'seq'</value>
</data>
<data name="RemarksHeader" xml:space="preserve"> <data name="RemarksHeader" xml:space="preserve">
<value>Remarks:</value> <value>Remarks:</value>
</data> </data>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Přidat chybějící parametr člena instance</target> <target state="translated">Přidat chybějící parametr člena instance</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Přidejte klíčové slovo new.</target> <target state="translated">Přidejte klíčové slovo new.</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Fehlenden Instanzmemberparameter hinzufügen</target> <target state="translated">Fehlenden Instanzmemberparameter hinzufügen</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Schlüsselwort "new" hinzufügen</target> <target state="translated">Schlüsselwort "new" hinzufügen</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Agregar parámetro de miembro de instancia que falta</target> <target state="translated">Agregar parámetro de miembro de instancia que falta</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Agregar "nueva" palabra clave</target> <target state="translated">Agregar "nueva" palabra clave</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Ajouter un paramètre de membre dinstance manquant</target> <target state="translated">Ajouter un paramètre de membre dinstance manquant</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Ajouter le mot clé 'new'</target> <target state="translated">Ajouter le mot clé 'new'</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Aggiungi parametro membro di istanza mancante</target> <target state="translated">Aggiungi parametro membro di istanza mancante</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Aggiungi la parola chiave 'new'</target> <target state="translated">Aggiungi la parola chiave 'new'</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">見つからないインスタンス メンバー パラメーターを追加する</target> <target state="translated">見つからないインスタンス メンバー パラメーターを追加する</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">'new' キーワードを追加する</target> <target state="translated">'new' キーワードを追加する</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">누락된 인스턴스 멤버 매개 변수 추가</target> <target state="translated">누락된 인스턴스 멤버 매개 변수 추가</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">'new' 키워드 추가</target> <target state="translated">'new' 키워드 추가</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Dodaj brakujący parametr składowej wystąpienia</target> <target state="translated">Dodaj brakujący parametr składowej wystąpienia</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Dodaj słowo kluczowe „new”</target> <target state="translated">Dodaj słowo kluczowe „new”</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Adicionar parâmetro de membro de instância ausente</target> <target state="translated">Adicionar parâmetro de membro de instância ausente</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Adicionar a palavra-chave 'new'</target> <target state="translated">Adicionar a palavra-chave 'new'</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Добавить отсутствующий параметр экземплярного элемента</target> <target state="translated">Добавить отсутствующий параметр экземплярного элемента</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">Добавить ключевое слово "new"</target> <target state="translated">Добавить ключевое слово "new"</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">Eksik örnek üye parametresini ekleyin</target> <target state="translated">Eksik örnek üye parametresini ekleyin</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">'new' anahtar sözcüğünü ekleme</target> <target state="translated">'new' anahtar sözcüğünü ekleme</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">添加缺少的实例成员参数</target> <target state="translated">添加缺少的实例成员参数</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">添加“新”关键字</target> <target state="translated">添加“新”关键字</target>

Просмотреть файл

@ -17,6 +17,11 @@
<target state="translated">新增缺少的執行個體成員參數</target> <target state="translated">新增缺少的執行個體成員參數</target>
<note /> <note />
</trans-unit> </trans-unit>
<trans-unit id="AddMissingSeq">
<source>Add missing 'seq'</source>
<target state="new">Add missing 'seq'</target>
<note />
</trans-unit>
<trans-unit id="AddNewKeyword"> <trans-unit id="AddNewKeyword">
<source>Add 'new' keyword</source> <source>Add 'new' keyword</source>
<target state="translated">新增 'new' 關鍵字</target> <target state="translated">新增 'new' 關鍵字</target>

Просмотреть файл

@ -0,0 +1,239 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
module FSharp.Editor.Tests.CodeFixes.AddMissingSeqTests
open Microsoft.VisualStudio.FSharp.Editor
open Xunit
open CodeFixTestFramework
let private codeFix = AddMissingSeqCodeFixProvider()
// This can be changed to Auto when featureDeprecatePlacesWhereSeqCanBeOmitted is out of preview.
let mode = WithOption "--langversion:preview"
[<Fact>]
let ``FS3873 Adds missing seq before { start..finish }`` () =
let code = "let xs = { 1..10 }"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = seq { 1..10 }"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds missing seq before { start..step..finish }`` () =
let code = "let xs = { 1..5..10 }"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = seq { 1..5..10 }"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS0740 Adds missing seq before { x; y }`` () =
let code = "let xs = { 1; 10 }"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = seq { 1; 10 }"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds missing seq before yield { start..finish }`` () =
let code = "let xs = [| yield { 1..100 } |]"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = [| yield seq { 1..100 } |]"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds missing seq before yield { start..finish } multiline`` () =
let code =
"""
let xs = [| yield seq { 1..100 }
yield { 1..100 } |]
"""
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode =
"""
let xs = [| yield seq { 1..100 }
yield seq { 1..100 } |]
"""
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds parens when needed app`` () =
let code = "let xs = id { 1..10 }"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = id (seq { 1..10 })"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds parens when needed app parens`` () =
let code = "let xs = ResizeArray({ 1..10 })"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = ResizeArray(seq { 1..10 })"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds parens when needed foreach`` () =
let code = "[ for x in { 1..10 } -> x ]"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "[ for x in seq { 1..10 } -> x ]"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds parens when needed dot`` () =
let code = "let s = { 1..10 }.ToString ()"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let s = (seq { 1..10 }).ToString ()"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS0740 Adds parens when needed app`` () =
let code = "let xs = id { 1; 10 }"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let xs = id (seq { 1; 10 })"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS0740 Adds parens when needed dot`` () =
let code = "let s = { 1; 10 }.ToString ()"
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode = "let s = (seq { 1; 10 }).ToString ()"
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS3873 Adds parens when needed multiline`` () =
let code =
"""
let xs =
id {
1..10
}
"""
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode =
"""
let xs =
id (seq {
1..10
})
"""
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)
[<Fact>]
let ``FS0740 Adds parens when needed multiline`` () =
let code =
"""
let xs =
id {
1; 10
}
"""
let expected =
Some
{
Message = "Add missing 'seq'"
FixedCode =
"""
let xs =
id (seq {
1; 10
})
"""
}
let actual = codeFix |> tryFix code mode
Assert.Equal(expected, actual)

Просмотреть файл

@ -72,6 +72,7 @@
<Compile Include="CodeFixes\ConvertCSharpUsingToFSharpOpenTests.fs" /> <Compile Include="CodeFixes\ConvertCSharpUsingToFSharpOpenTests.fs" />
<Compile Include="CodeFixes\ReplaceWithSuggestionTests.fs" /> <Compile Include="CodeFixes\ReplaceWithSuggestionTests.fs" />
<Compile Include="CodeFixes\RemoveUnnecessaryParenthesesTests.fs" /> <Compile Include="CodeFixes\RemoveUnnecessaryParenthesesTests.fs" />
<Compile Include="CodeFixes\AddMissingSeqTests.fs" />
<Compile Include="Refactors\RefactorTestFramework.fs" /> <Compile Include="Refactors\RefactorTestFramework.fs" />
<Compile Include="Refactors\AddReturnTypeTests.fs" /> <Compile Include="Refactors\AddReturnTypeTests.fs" />
<Compile Include="Hints\HintTestFramework.fs" /> <Compile Include="Hints\HintTestFramework.fs" />