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

Commit2a0e1b3

Browse files
authored
Disallow optional type extensions on byref types (dotnet#5472)
* Disallow optional type extensions on byref types* Normalizing test names
1 parentac59b22 commit2a0e1b3

22 files changed

+146
-46
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,9 @@ type internal SR private() =
43544354
/// Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.
43554355
/// (Originally from ..\FSComp.txt:1442)
43564356
static membertcCannotCallExtensionMemberInrefToByref()=(3237, GetStringFunc("tcCannotCallExtensionMemberInrefToByref",",,,"))
4357+
/// Byref types are not allowed to have optional type extensions.
4358+
/// (Originally from ..\FSComp.txt:1443)
4359+
static membertcByrefsMayNotHaveTypeExtensions()=(3238, GetStringFunc("tcByrefsMayNotHaveTypeExtensions",",,,"))
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("chkNoSpanLikeValueFromExpression"))
57715774
ignore(GetString("tastCantTakeAddressOfExpression"))
57725775
ignore(GetString("tcCannotCallExtensionMemberInrefToByref"))
5776+
ignore(GetString("tcByrefsMayNotHaveTypeExtensions"))
57735777
()

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4357,4 +4357,7 @@
43574357
<dataname="tcCannotCallExtensionMemberInrefToByref"xml:space="preserve">
43584358
<value>Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</value>
43594359
</data>
4360+
<dataname="tcByrefsMayNotHaveTypeExtensions"xml:space="preserve">
4361+
<value>Byref types are not allowed to have optional type extensions.</value>
4362+
</data>
43604363
</root>

‎src/fsharp/FSComp.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,4 +1439,5 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl
14391439
3234,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."
14401440
3235,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."
14411441
3236,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."
1442-
3237,tcCannotCallExtensionMemberInrefToByref,"Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref."
1442+
3237,tcCannotCallExtensionMemberInrefToByref,"Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref."
1443+
3238,tcByrefsMayNotHaveTypeExtensions,"Byref types are not allowed to have optional type extensions."

‎src/fsharp/TypeChecker.fs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16319,9 +16319,14 @@ module TcDeclarations =
1631916319
let tyDeclRange = synTyconInfo.Range
1632016320
let (ComponentInfo(_, typars, cs, longPath, _, _, _, _)) = synTyconInfo
1632116321
let declKind, tcref, declaredTyconTypars = ComputeTyconDeclKind tyconOpt isAtOriginalTyconDefn cenv envForDecls false tyDeclRange typars cs longPath
16322-
let newslotsOK = (if isAtOriginalTyconDefn && tcref.IsFSharpObjectModelTycon then NewSlotsOK else NoNewSlots)
16322+
let newslotsOK = (if isAtOriginalTyconDefn && tcref.IsFSharpObjectModelTycon then NewSlotsOK else NoNewSlots)
16323+
16324+
if (declKind = ExtrinsicExtensionBinding) && isByrefTyconRef cenv.g tcref then
16325+
error(Error(FSComp.SR.tcByrefsMayNotHaveTypeExtensions(), tyDeclRange))
16326+
1632316327
if not (isNil members) && tcref.IsTypeAbbrev then
1632416328
errorR(Error(FSComp.SR.tcTypeAbbreviationsCannotHaveAugmentations(), tyDeclRange))
16329+
1632516330
MutRecDefnsPhase2DataForTycon(tyconOpt, innerParent, declKind, tcref, baseValOpt, safeInitInfo, declaredTyconTypars, members, tyDeclRange, newslotsOK, fixupFinalAttrs))
1632616331

1632716332
// By now we've established the full contents of type definitions apart from their

‎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">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unitid="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<targetstate="new">Byref types are not allowed to have optional type extensions.</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">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<target state="new">Byref types are not allowed to have optional type extensions.</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">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unitid="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<targetstate="new">Byref types are not allowed to have optional type extensions.</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">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<target state="new">Byref types are not allowed to have optional type extensions.</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">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<target state="new">Byref types are not allowed to have optional type extensions.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7062,6 +7062,11 @@
70627062
<target state="new">Cannot call the extension member as it requires the value to be mutable or a byref type due to the extending type being used as a byref.</target>
70637063
<note />
70647064
</trans-unit>
7065+
<trans-unit id="tcByrefsMayNotHaveTypeExtensions">
7066+
<source>Byref types are not allowed to have optional type extensions.</source>
7067+
<target state="new">Byref types are not allowed to have optional type extensions.</target>
7068+
<note />
7069+
</trans-unit>
70657070
</body>
70667071
</file>
70677072
</xliff>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp