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

Commit3176821

Browse files
authored
Fixed internal error on struct tuple with struct constraint (dotnet#6078)
* Fixed internal error on struct tuple with struct constraint* Added test case* Checking for isAppTy differently. We get a different error but more accurate* Added positive code* Fixed test
1 parent66b20f9 commit3176821

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
lines changed

‎src/fsharp/ConstraintSolver.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,7 @@ and SolveTypeIsNonNullableValueType (csenv:ConstraintSolverEnv) ndeep m2 trace t
18861886
|_->
18871887
letunderlyingTy= stripTyEqnsAndMeasureEqns g ty
18881888
if isStructTy g underlyingTythen
1889-
if tyconRefEq g g.system_Nullable_tcref(tcrefOfAppTy g underlyingTy)then
1889+
ifisAppTy g underlyingTy&&tyconRefEq g g.system_Nullable_tcref(tcrefOfAppTy g underlyingTy)then
18901890
return! ErrorD(ConstraintSolverError(FSComp.SR.csTypeParameterCannotBeNullable(), m, m))
18911891
else
18921892
return! ErrorD(ConstraintSolverError(FSComp.SR.csGenericConstructRequiresStructType(NicePrint.minimalStringOfType denv ty), m, m2))

‎tests/fsharp/tests.fs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,12 @@ module TypecheckTests =
19851985
fsc cfg"%s --target:exe -o:pos31.exe --warnaserror" cfg.fsc_flags["pos31.fsi";"pos31.fs"]
19861986
peverify cfg"pos31.exe"
19871987

1988+
[<Test>]
1989+
let``sigs pos32``()=
1990+
letcfg= testConfig"typecheck/sigs"
1991+
fsc cfg"%s --target:library -o:pos32.dll --warnaserror" cfg.fsc_flags["pos32.fs"]
1992+
peverify cfg"pos32.dll"
1993+
19881994
[<Test>]
19891995
let``sigs pos23``()=
19901996
letcfg= testConfig"typecheck/sigs"
@@ -2470,6 +2476,9 @@ module TypecheckTests =
24702476
[<Test>]
24712477
let``type check neg114``()= singleNegTest(testConfig"typecheck/sigs")"neg114"
24722478

2479+
[<Test>]
2480+
let``type check neg115``()= singleNegTest(testConfig"typecheck/sigs")"neg115"
2481+
24732482
[<Test>]
24742483
let``type check neg_anon_1``()= singleNegTest(testConfig"typecheck/sigs")"neg_anon_1"
24752484

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
neg115.fs(8,30,8,34): typecheck error FS0001: Expecting a type supporting the operator 'get_Item1' but given a tuple type
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
moduleM
3+
4+
let inlinetest(arg:^Twhen^T:struct)=
5+
(^T:(memberItem1:_)(arg))
6+
7+
letf()=
8+
leta= teststruct(1,2)
9+
()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
modulePos32
2+
3+
let inlinetest(arg:^Twhen^T:struct)=
4+
()
5+
6+
letf()=
7+
leta= teststruct(1,2)
8+
()
9+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp