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

Commit2c3cfbf

Browse files
dsymeKevinRansom
authored andcommitted
fix tuple warnings (dotnet#4389)
* fix tuple warnings* fix tuple warnings* fix tuple warnings* fix tuple warnings
1 parent7131143 commit2c3cfbf

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ let MethInfoChecks g amap isInstance tyargsOpt objArgs ad m (minfo:MethInfo) =
174174
if not (IsTypeAndMethInfoAccessible amap m adOriginal ad minfo) then
175175
error (Error (FSComp.SR.tcMethodNotAccessible(minfo.LogicalName), m))
176176

177-
if isAnyTupleTy g minfo.ApparentEnclosingTypethen
177+
if isAnyTupleTy g minfo.ApparentEnclosingType&& not minfo.IsExtensionMember && (minfo.LogicalName.StartsWith "get_Item" || minfo.LogicalName.StartsWith "get_Rest") then
178178
warning (Error (FSComp.SR.tcTupleMemberNotNormallyUsed(), m))
179179

180180
CheckMethInfoAttributes g m tyargsOpt minfo |> CommitOperationResult

‎tests/fsharp/typecheck/sigs/neg101.fs‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
moduleM
3-
3+
openSystem
44
typeMyRec={ Foo:string}
55

66
letx:int=1
@@ -47,4 +47,16 @@ let x1 =
4747
(1,2,3,4,5,6,7,8).Item7]
4848

4949
letx2=(1,2,3,4,5,6,7,8).Rest// gives a warning
50-
letx3=(1,2).Rest// gives an actual error
50+
letx3=(1,2).Rest// gives an actual error
51+
letx4=(struct(1,2)).ToTuple()// no error or warning
52+
53+
openSystem.Runtime.CompilerServices
54+
55+
[<Extension>]
56+
typeTupleEx()=
57+
[<Extension>]
58+
static member inlineDo((x,y):(int*string))=()
59+
60+
letx=1,"2"
61+
62+
x.Do()// no warning

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp