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

Commit6c801b2

Browse files
author
Kevin Ransom
committed
Test case for reversion
1 parent37213bb commit6c801b2

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
(***************** Repro for issue#5246 ---- https://github.com/Microsoft/visualfsharp/issues/5246*****************)
2+
(*
3+
When the bug was present we saw this error:
4+
5+
Compile errors are raised:
6+
error FS0041: A unique overload for method 'ofObject' could not be determined based on type
7+
information prior to this program point. A type annotation may be needed.
8+
Candidates: static member Methods.ofObject : t0:'a -> Methods option when 'a : null,
9+
static member Methods.ofObject : t1:'a -> Methods option when 'a :> ITest1 and 'a : null
10+
11+
Expected behavior
12+
The code should compile fine (possibly with a warning on :? obj always succeeding).
13+
14+
*)
15+
16+
moduleTestOfObj=
17+
18+
type[<AllowNullLiteral>]ITest1=interfaceend
19+
20+
typeMethods=
21+
| Test1ofITest1
22+
| Otherofobj
23+
24+
static memberofObject t1= Option.ofObj t1|> Option.map Test1
25+
static memberofObject t0= Option.ofObj t0|> Option.map Other
26+
27+
static memberconvert(x:obj)=
28+
match xwith
29+
|:? ITest1as one-> Methods.ofObject one
30+
|:? objas one-> Methods.ofObject one

‎tests/fsharp/tests.fs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,11 +1630,17 @@ module RegressionTests =
16301630
[<Test>]
16311631
let``literal-value-bug-2-FSI_BASIC``()= singleTestBuildAndRun"regression/literal-value-bug-2" FSI_BASIC
16321632

1633+
[<Test>]
1634+
let``OverloadResolution-bug-FSC_BASIC``()= singleTestBuildAndRun"regression/OverloadResolution-bug" FSC_BASIC
1635+
1636+
[<Test>]
1637+
let``OverloadResolution-bug-FSI_BASIC``()= singleTestBuildAndRun"regression/OverloadResolution-bug" FSI_BASIC
1638+
16331639
[<Test>]
16341640
let``struct-tuple-bug-1-FSC_BASIC``()= singleTestBuildAndRun"regression/struct-tuple-bug-1" FSC_BASIC
16351641

16361642
[<Test >]
1637-
let``tuple-bug-1``()= singleTestBuildAndRun"regression/tuple-bug-1" FSC_BASIC
1643+
let``tuple-bug-1-FSC_BASIC``()= singleTestBuildAndRun"regression/tuple-bug-1" FSC_BASIC
16381644

16391645
[<Test>]
16401646
let``26``()= singleTestBuildAndRun"regression/26" FSC_BASIC

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp