Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
94885f55
F
fsharp
项目概览
dotNET Platform
/
fsharp
10 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
94885f55
编写于
12月 30, 2020
作者:
E
Erik Schierboom
提交者:
GitHub
12月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Raise error when using active pattern in literal binding (#10816)
上级
2338353c
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
89 addition
and
1 deletion
+89
-1
src/fsharp/CheckExpressions.fs
src/fsharp/CheckExpressions.fs
+3
-0
src/fsharp/FSComp.txt
src/fsharp/FSComp.txt
+1
-0
src/fsharp/xlf/FSComp.txt.cs.xlf
src/fsharp/xlf/FSComp.txt.cs.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.de.xlf
src/fsharp/xlf/FSComp.txt.de.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.es.xlf
src/fsharp/xlf/FSComp.txt.es.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.fr.xlf
src/fsharp/xlf/FSComp.txt.fr.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.it.xlf
src/fsharp/xlf/FSComp.txt.it.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.ja.xlf
src/fsharp/xlf/FSComp.txt.ja.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.ko.xlf
src/fsharp/xlf/FSComp.txt.ko.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.pl.xlf
src/fsharp/xlf/FSComp.txt.pl.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.pt-BR.xlf
src/fsharp/xlf/FSComp.txt.pt-BR.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.ru.xlf
src/fsharp/xlf/FSComp.txt.ru.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.tr.xlf
src/fsharp/xlf/FSComp.txt.tr.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
+5
-0
src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
+5
-0
tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs
...piler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs
+18
-0
tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
...iler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
+2
-1
未找到文件。
src/fsharp/CheckExpressions.fs
浏览文件 @
94885f55
...
...
@@ -9755,6 +9755,9 @@ and TcLetBinding cenv isUse env containerInfo declKind tpenv (synBinds, synBinds
| _ when inlineFlag.MustInline ->
error(Error(FSComp.SR.tcInvalidInlineSpecification(), m))
| TPat_query _ when HasFSharpAttribute cenv.g cenv.g.attrib_LiteralAttribute attrs ->
error(Error(FSComp.SR.tcLiteralAttributeCannotUseActivePattern(), m))
| _ ->
let tmp, _ = mkCompGenLocal m "patternInput" (generalizedTypars +-> tauTy)
...
...
src/fsharp/FSComp.txt
浏览文件 @
94885f55
...
...
@@ -1552,3 +1552,4 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable
3390,xmlDocDuplicateParameter,"This XML comment is invalid: multiple documentation entries for parameter '%s'"
3390,xmlDocUnresolvedCrossReference,"This XML comment is invalid: unresolved cross-reference '%s'"
3390,xmlDocMissingParameter,"This XML comment is incomplete: no documentation for parameter '%s'"
3391,tcLiteralAttributeCannotUseActivePattern,"A [<Literal>] declaration cannot use an active pattern for its identifier"
\ No newline at end of file
src/fsharp/xlf/FSComp.txt.cs.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target
state=
"translated"
>
use! se nedá kombinovat s and!.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralAttributeCannotUseActivePattern"
>
<source>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</source>
<target
state=
"new"
>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralFieldAssignmentNoArg"
>
<source>
Cannot assign a value to another value marked literal
</source>
<target
state=
"translated"
>
Hodnota se nedá přiřadit k jiné hodnotě, která je označená jako literál.
</target>
...
...
src/fsharp/xlf/FSComp.txt.de.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">"use!" darf nicht mit "and!" kombiniert werden.</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Ein Wert kann keinem anderen als Literal markierten Wert zugewiesen werden.</target>
...
...
src/fsharp/xlf/FSComp.txt.es.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">No se puede combinar use! con and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">No se puede asignar un valor a otro marcado como literal</target>
...
...
src/fsharp/xlf/FSComp.txt.fr.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">use! ne peut pas être combiné avec and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Impossible d'affecter une valeur à une autre valeur marquée comme littérale</target>
...
...
src/fsharp/xlf/FSComp.txt.it.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">Non è possibile combinare use! con and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Non è possibile assegnare un valore a un altro valore contrassegnato come letterale</target>
...
...
src/fsharp/xlf/FSComp.txt.ja.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target
state=
"translated"
>
use! を and! と組み合わせて使用することはできません
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralAttributeCannotUseActivePattern"
>
<source>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</source>
<target
state=
"new"
>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralFieldAssignmentNoArg"
>
<source>
Cannot assign a value to another value marked literal
</source>
<target
state=
"translated"
>
リテラルとしてマークされた別の値に値を割り当てることはできません
</target>
...
...
src/fsharp/xlf/FSComp.txt.ko.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target
state=
"translated"
>
use!는 and!와 함께 사용할 수 없습니다.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralAttributeCannotUseActivePattern"
>
<source>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</source>
<target
state=
"new"
>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralFieldAssignmentNoArg"
>
<source>
Cannot assign a value to another value marked literal
</source>
<target
state=
"translated"
>
리터럴로 표시된 다른 값에 값을 할당할 수 없습니다.
</target>
...
...
src/fsharp/xlf/FSComp.txt.pl.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">Elementu use! nie można łączyć z elementem and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Nie można przypisać wartości do innej wartości oznaczonej jako literał</target>
...
...
src/fsharp/xlf/FSComp.txt.pt-BR.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">use! não pode ser combinado com and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Não é possível atribuir um valor a outro valor marcado como literal</target>
...
...
src/fsharp/xlf/FSComp.txt.ru.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">use! запрещено сочетать с and!</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Невозможно присвоить значение другому значению, помеченному как литерал</target>
...
...
src/fsharp/xlf/FSComp.txt.tr.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target state="translated">use!, and! ile birleştirilemez</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralAttributeCannotUseActivePattern">
<source>A [<Literal>] declaration cannot use an active pattern for its identifier</source>
<target state="new">A [<Literal>] declaration cannot use an active pattern for its identifier</target>
<note />
</trans-unit>
<trans-unit id="tcLiteralFieldAssignmentNoArg">
<source>Cannot assign a value to another value marked literal</source>
<target state="translated">Sabit değer olarak işaretlenen bir değere başka bir değer atanamaz</target>
...
...
src/fsharp/xlf/FSComp.txt.zh-Hans.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target
state=
"translated"
>
use! 不得与 and! 结合使用
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralAttributeCannotUseActivePattern"
>
<source>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</source>
<target
state=
"new"
>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralFieldAssignmentNoArg"
>
<source>
Cannot assign a value to another value marked literal
</source>
<target
state=
"translated"
>
无法将值分配给标记为文本的其他值
</target>
...
...
src/fsharp/xlf/FSComp.txt.zh-Hant.xlf
浏览文件 @
94885f55
...
...
@@ -367,6 +367,11 @@
<target
state=
"translated"
>
use! 不可與 and! 合併
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralAttributeCannotUseActivePattern"
>
<source>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</source>
<target
state=
"new"
>
A [
<
Literal
>
] declaration cannot use an active pattern for its identifier
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"tcLiteralFieldAssignmentNoArg"
>
<source>
Cannot assign a value to another value marked literal
</source>
<target
state=
"translated"
>
無法將值指派給標記為常值的其他值
</target>
...
...
tests/FSharp.Compiler.ComponentTests/ErrorMessages/InvalidLiteralTests.fs
0 → 100644
浏览文件 @
94885f55
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace
FSharp
.
Compiler
.
ComponentTests
.
ErrorMessages
open
Xunit
open
FSharp
.
Test
.
Utilities
.
Compiler
module
``Invalid literals``
=
[<
Fact
>]
let
``Using Active Pattern``
()
=
FSharp
"""
let (|A|) x = x + 1
let [<Literal>] (A x) = 1
"""
|>
typecheck
|>
shouldFail
|>
withSingleDiagnostic
(
Error
3391
,
Line
3
,
Col
17
,
Line
3
,
Col
22
,
"A [<Literal>] declaration cannot use an active pattern for its identifier"
)
tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
浏览文件 @
94885f55
...
...
@@ -29,7 +29,8 @@
<Compile
Include=
"ErrorMessages\ConstructorTests.fs"
/>
<Compile
Include=
"ErrorMessages\DontSuggestTests.fs"
/>
<Compile
Include=
"ErrorMessages\ElseBranchHasWrongTypeTests.fs"
/>
<Compile
Include=
"ErrorMessages\InvalidNumericLiteralTests.fs"
/>
<Compile
Include=
"ErrorMessages\InvalidLiteralTests.fs"
/>
<Compile
Include=
"ErrorMessages\InvalidNumericLiteralTests.fs"
/>
<Compile
Include=
"ErrorMessages\MissingElseBranch.fs"
/>
<Compile
Include=
"ErrorMessages\MissingExpressionTests.fs"
/>
<Compile
Include=
"ErrorMessages\ModuleAbbreviationTests.fs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录