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

Commit663adf2

Browse files
committed
Fix 238
1 parent1251430 commit663adf2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

‎src/fsharp/csolve.fs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,7 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
11571157
IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef&&
11581158
not rfinfo.LiteralValue.IsSome&&
11591159
not rfinfo.RecdField.IsCompilerGenerated->
1160-
Some(TTraitSolvedRecdProp(rfinfo, isSetProp))
1160+
Some(TTraitSolvedRecdProp(rfinfo, isSetProp), rfinfo.FieldType)
11611161
|_-> None)
11621162
match propswith
11631163
|[ prop]-> Some prop
@@ -1210,9 +1210,9 @@ and SolveMemberConstraint (csenv:ConstraintSolverEnv) permitWeakResolution ndeep
12101210
CollectThenUndo(fun trace-> ResolveOverloading csenv(WithTrace(trace)) nm ndeeptrue(0,0) AccessibleFromEverywhere calledMethGroupfalse(Some rty))
12111211

12121212
match recdPropSearch, methOverloadResultwith
1213-
| Somea, None->
1214-
// OK, the constraint is solved by a record property
1215-
ResultDa
1213+
| Some(sln, rty2), None->
1214+
// OK, the constraint is solved by a record property. Assert that the return types match.
1215+
SolveTypEqualsTypKeepAbbrevs csenv ndeep m2 trace rty rty2++(fun()->ResultDsln)
12161216
| None, Some(calledMeth:CalledMeth<_>)->
12171217
// OK, the constraint is solved.
12181218
// Re-run without undo to commit the inference equations. Throw errors away

‎tests/fsharp/core/subtype/test.fsx‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,16 @@ module RecordPropertyConstraintTests =
16961696
check"ckjwnewk"(f8())(System.TimeSpan.FromSeconds2.0)// after mutation
16971697
check"ckjwnewk"(f10())"Gary"
16981698

1699+
1700+
// See https://github.com/Microsoft/visualfsharp/issues/238
1701+
moduleGenericPropertyConstraintSolvedByRecord=
1702+
1703+
typehober<'a>={ foo:'a}
1704+
1705+
let inlineprint_foo_memb x= box(^a:(memberfoo: 'b) x)
1706+
1707+
letv= print_foo_memb{ foo=1}
1708+
16991709
letaa=
17001710
ifnot failures.IsEmptythen(printfn"Test Failed, failures =%A" failures; exit1)
17011711

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp