Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8189443

Browse files
authored
Merge pull requestdotnet#5610 from KevinRansom/warnoncustomattribute
Warn/Error when a Custom Attribute does not derive from Attribute
2 parentse409575 +9834713 commit8189443

File tree

32 files changed

+149
-8
lines changed

32 files changed

+149
-8
lines changed

‎src/buildfromsource/FSharp.Compiler.Private/FSComp.fs‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,7 +4144,7 @@ type internal SR private() =
41444144
/// Used to associate, or bind, a name to a value or function.
41454145
/// (Originally from ..\FSComp.txt:1372)
41464146
static memberkeywordDescriptionLet()=(GetStringFunc("keywordDescriptionLet",",,,"))
4147-
/// Used inasynchronous workflows to bind a name to the result of an asynchronouscomputation, or, in other computationexpressions, usedto bind a name toa result, which isofthe computationtype.
4147+
/// Used in computationexpressionsto bind a name tothe resultofanother computationexpression.
41484148
/// (Originally from ..\FSComp.txt:1373)
41494149
static memberkeywordDescriptionLetBang()=(GetStringFunc("keywordDescriptionLetBang",",,,"))
41504150
/// Used to branch by comparing a value to a pattern.
@@ -4195,10 +4195,10 @@ type internal SR private() =
41954195
/// Used to indicate that a function is recursive.
41964196
/// (Originally from ..\FSComp.txt:1389)
41974197
static memberkeywordDescriptionRec()=(GetStringFunc("keywordDescriptionRec",",,,"))
4198-
/// Used toindicate a valueto provide asthe result ofa computation expression.
4198+
/// Used toprovide a valueforthe result ofthe containing computation expression.
41994199
/// (Originally from ..\FSComp.txt:1390)
42004200
static memberkeywordDescriptionReturn()=(GetStringFunc("keywordDescriptionReturn",",,,"))
4201-
/// Used toindicate a computation expression that, when evaluated, provides the result of thecontaining computation expression.
4201+
/// Used toprovide avalue for the result of the containingcomputation expression, where that value itself comes from theresult another computation expression.
42024202
/// (Originally from ..\FSComp.txt:1391)
42034203
static memberkeywordDescriptionReturnBang()=(GetStringFunc("keywordDescriptionReturnBang",",,,"))
42044204
/// Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context.
@@ -4225,10 +4225,10 @@ type internal SR private() =
42254225
/// Used to convert to a type that is higher in the inheritance chain.
42264226
/// (Originally from ..\FSComp.txt:1399)
42274227
static memberkeywordDescriptionUpcast()=(GetStringFunc("keywordDescriptionUpcast",",,,"))
4228-
/// Used instead of let for values thatrequire Dispose to be called to free resources.
4228+
/// Used instead of let for values thatimplement IDisposable"
42294229
/// (Originally from ..\FSComp.txt:1400)
42304230
static memberkeywordDescriptionUse()=(GetStringFunc("keywordDescriptionUse",",,,"))
4231-
/// Used instead of let! inasynchronous workflows and othercomputation expressions forvalues that require Dispose to be called to free resources.
4231+
/// Used instead of let! in computation expressions forcomputation expression results that implement IDisposable.
42324232
/// (Originally from ..\FSComp.txt:1401)
42334233
static memberkeywordDescriptionUseBang()=(GetStringFunc("keywordDescriptionUseBang",",,,"))
42344234
/// Used in a signature to indicate a value, or in a type to declare a member, in limited situations.
@@ -4354,6 +4354,9 @@ type internal SR private() =
43544354
/// Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address.
43554355
/// (Originally from ..\FSComp.txt:1442)
43564356
static membertastCantTakeAddressOfExpression()=(3237, GetStringFunc("tastCantTakeAddressOfExpression",",,,"))
4357+
/// This type does not inherit Attribute, it will not work correctly with other .NET languages.
4358+
/// (Originally from ..\FSComp.txt:1443)
4359+
static membertcTypeDoesNotInheritAttribute()=(3242, GetStringFunc("tcTypeDoesNotInheritAttribute",",,,"))
43574360

43584361
/// Call this method once to validate that all known resources are valid; throws if not
43594362
static memberRunStartupValidation()=
@@ -5770,4 +5773,5 @@ type internal SR private() =
57705773
ignore(GetString("chkNoSpanLikeVariable"))
57715774
ignore(GetString("chkNoSpanLikeValueFromExpression"))
57725775
ignore(GetString("tastCantTakeAddressOfExpression"))
5776+
ignore(GetString("tcTypeDoesNotInheritAttribute"))
57735777
()

‎src/buildfromsource/FSharp.Compiler.Private/FSComp.resx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4228,10 +4228,10 @@
42284228
<value>Used to convert to a type that is higher in the inheritance chain.</value>
42294229
</data>
42304230
<dataname="keywordDescriptionUse"xml:space="preserve">
4231-
<value>Used instead of let for values thatrequire Dispose to be called to free resources.</value>
4231+
<value>Used instead of let for values thatimplement IDisposable"</value>
42324232
</data>
42334233
<dataname="keywordDescriptionUseBang"xml:space="preserve">
4234-
<value>Used instead of let! in computation expressions forvalues that require Dispose to be called to free resources.</value>
4234+
<value>Used instead of let! in computation expressions forcomputation expression results that implement IDisposable.</value>
42354235
</data>
42364236
<dataname="keywordDescriptionVal"xml:space="preserve">
42374237
<value>Used in a signature to indicate a value, or in a type to declare a member, in limited situations.</value>
@@ -4357,4 +4357,7 @@
43574357
<dataname="tastCantTakeAddressOfExpression"xml:space="preserve">
43584358
<value>Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address.</value>
43594359
</data>
4360+
<dataname="tcTypeDoesNotInheritAttribute"xml:space="preserve">
4361+
<value>This type does not inherit Attribute, it will not work correctly with other .NET languages.</value>
4362+
</data>
43604363
</root>

‎src/fsharp/FSComp.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,3 +1440,4 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
14401440
3235,chkNoSpanLikeVariable,"The Span or IsByRefLike variable '%s' cannot be used at this point. This is to ensure the address of the local value does not escape its scope."
14411441
3236,chkNoSpanLikeValueFromExpression,"A Span or IsByRefLike value returned from the expression cannot be used at ths point. This is to ensure the address of the local value does not escape its scope."
14421442
3237,tastCantTakeAddressOfExpression,"Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address."
1443+
3242,tcTypeDoesNotInheritAttribute,"This type does not inherit Attribute, it will not work correctly with other .NET languages."

‎src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
3939
<Prefer32BitCondition="'$(Prefer32Bit)' == ''">false</Prefer32Bit>
4040
<TreatWarningsAsErrorsCondition="'$(TreatWarningsAsErrors)' == ''">false</TreatWarningsAsErrors>
4141
<WarningLevelCondition=" '$(WarningLevel)' == ''">3</WarningLevel>
42-
<WarningsAsErrorsCondition="'$(WarningsAsErrors)' == ''" />
42+
<WarningsAsErrors>3239;$(WarningsAsErrors)</WarningsAsErrors>
4343
<UseStandardResourceNamesCondition=" '$(UseStandardResourceNames)' == ''">true</UseStandardResourceNames>
4444
</PropertyGroup>
4545

‎src/fsharp/TypeChecker.fs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10747,6 +10747,7 @@ and TcAttribute canFail cenv (env: TcEnv) attrTgt (synAttr: SynAttribute) =
1074710747
| Exception _ when canFail -> [ ], true
1074810748
| res ->
1074910749
let item = ForceRaise res
10750+
if not (ExistsHeadTypeInEntireHierarchy cenv.g cenv.amap mAttr ty cenv.g.tcref_System_Attribute) then warning(Error(FSComp.SR.tcTypeDoesNotInheritAttribute(), mAttr))
1075010751
let attrib =
1075110752
match item with
1075210753
| Item.CtorGroup(methodName, minfos) ->

‎src/fsharp/xlf/FSComp.txt.cs.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<targetstate="new">The Span or IsByRefLike expression cannot be returned from this function or method, because it is composed using elements that may escape their scope.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unitid="tcTypeDoesNotInheritAttribute">
7066+
<source>This type does not inherit Attribute, it will not work correctly with other .NET languages.</source>
7067+
<targetstate="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

‎src/fsharp/xlf/FSComp.txt.de.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<target state="new">The Span or IsByRefLike expression cannot be returned from this function or method, because it is composed using elements that may escape their scope.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcTypeDoesNotInheritAttribute">
7066+
<source>This type does not inherit Attribute, it will not work correctly with other .NET languages.</source>
7067+
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

‎src/fsharp/xlf/FSComp.txt.en.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<targetstate="new">The Span or IsByRefLike expression cannot be returned from this function or method, because it is composed using elements that may escape their scope.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unitid="tcTypeDoesNotInheritAttribute">
7066+
<source>This type does not inherit Attribute, it will not work correctly with other .NET languages.</source>
7067+
<targetstate="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

‎src/fsharp/xlf/FSComp.txt.es.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<target state="new">The Span or IsByRefLike expression cannot be returned from this function or method, because it is composed using elements that may escape their scope.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcTypeDoesNotInheritAttribute">
7066+
<source>This type does not inherit Attribute, it will not work correctly with other .NET languages.</source>
7067+
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

‎src/fsharp/xlf/FSComp.txt.fr.xlf‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<target state="new">The Span or IsByRefLike expression cannot be returned from this function or method, because it is composed using elements that may escape their scope.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcTypeDoesNotInheritAttribute">
7066+
<source>This type does not inherit Attribute, it will not work correctly with other .NET languages.</source>
7067+
<target state="new">This type does not inherit Attribute, it will not work correctly with other .NET languages.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp