Skip to content

Commit 4034f0f

Browse files
smoothdeveloperbrettfo
authored andcommitted
Migrate a set of fsharpqa tests to new test suite (overload resolution error messages) (#6654)
* migrate (as a separate copy) fsharpqa tests that are going to be impacted by #6596 the baseline files are empty on purpose, expecting CI failure reporting those tests, I intend to update the baseline and clean up the comments / xml tags from fsharpqa syntax in later commit, and then remove those specific tests altogether from fsharpqa if this is OK with the maintainers. * update the .bsl files * remove comments that are handled by baseline files, update baseline files * remove the migrated tests from fsharpqa tests * need to be more careful when migrating those * testing if running the test with .fs instead of .fsx makes them work on .netcore * exclude migrated fsharpqa from dotnet core run
1 parent 2cac0e1 commit 4034f0f

33 files changed

+628
-61
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
E_Slices01.fsx(22,9,22,19): typecheck error FS0041: A unique overload for method 'GetSlice' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member Foo.GetSlice : x:int * y1:int option * y2:float option -> unit, member Foo.GetSlice : x:int * y1:int option * y2:int option -> unit
3+
4+
E_Slices01.fsx(23,9,23,17): typecheck error FS0041: A unique overload for method 'GetSlice' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member Foo.GetSlice : x:int * y1:int option * y2:float option -> unit, member Foo.GetSlice : x:int * y1:int option * y2:int option -> unit
5+
6+
E_Slices01.fsx(24,9,24,19): typecheck error FS0041: A unique overload for method 'GetSlice' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member Foo.GetSlice : x1:float option * x2:int option * y:int -> unit, member Foo.GetSlice : x1:int option * x2:int option * y:int -> unit
7+
8+
E_Slices01.fsx(25,9,25,17): typecheck error FS0041: A unique overload for method 'GetSlice' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: member Foo.GetSlice : x1:float option * x2:int option * y:int -> unit, member Foo.GetSlice : x1:int option * x2:int option * y:int -> unit
9+
10+
E_Slices01.fsx(26,9,26,17): typecheck error FS0039: The field, constructor or member 'Item' is not defined.
11+
12+
E_Slices01.fsx(27,9,27,26): typecheck error FS0503: A member or object constructor 'GetSlice' taking 4 arguments is not accessible from this code location. All accessible versions of method 'GetSlice' take 3 arguments.
13+
14+
E_Slices01.fsx(28,9,28,20): typecheck error FS0503: A member or object constructor 'GetSlice' taking 5 arguments is not accessible from this code location. All accessible versions of method 'GetSlice' take 3 arguments.

tests/fsharp/conformance/inference/E_Clashing_Values_in_AbstractClass01.bsl

Whitespace-only changes.

tests/fsharp/conformance/inference/E_Clashing_Values_in_AbstractClass03.bsl

Whitespace-only changes.

tests/fsharp/conformance/inference/E_Clashing_Values_in_AbstractClass04.bsl

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
E_LeftToRightOverloadResolution01.fsx(7,23,7,51): typecheck error FS0041: A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: System.Console.WriteLine(buffer: char []) : unit, System.Console.WriteLine(format: string, [<System.ParamArray>] arg: obj []) : unit, System.Console.WriteLine(value: bool) : unit, System.Console.WriteLine(value: char) : unit, System.Console.WriteLine(value: decimal) : unit, System.Console.WriteLine(value: float) : unit, System.Console.WriteLine(value: float32) : unit, System.Console.WriteLine(value: int) : unit, System.Console.WriteLine(value: int64) : unit, System.Console.WriteLine(value: obj) : unit, System.Console.WriteLine(value: string) : unit, System.Console.WriteLine(value: uint32) : unit, System.Console.WriteLine(value: uint64) : unit
3+
4+
E_LeftToRightOverloadResolution01.fsx(9,23,9,51): typecheck error FS0041: A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: System.Console.WriteLine(buffer: char []) : unit, System.Console.WriteLine(format: string, [<System.ParamArray>] arg: obj []) : unit, System.Console.WriteLine(value: bool) : unit, System.Console.WriteLine(value: char) : unit, System.Console.WriteLine(value: decimal) : unit, System.Console.WriteLine(value: float) : unit, System.Console.WriteLine(value: float32) : unit, System.Console.WriteLine(value: int) : unit, System.Console.WriteLine(value: int64) : unit, System.Console.WriteLine(value: obj) : unit, System.Console.WriteLine(value: string) : unit, System.Console.WriteLine(value: uint32) : unit, System.Console.WriteLine(value: uint64) : unit
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// #Regression #TypeInference
2+
// Regression for FSHARP1.0:5749
3+
// Better error message for overload resolution to help ease pain associated with mismatch of intellisense information
4+
5+
6+
let array = [| "Ted"; "Katie"; |]
7+
Array.iter (fun it -> System.Console.WriteLine(it))
8+
9+
Array.iter (fun it -> System.Console.WriteLine(it)) array
10+
11+
array |> Array.iter (fun it -> System.Console.WriteLine(it))
12+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
E_OneTypeVariable03.fsx(60,34,60,44): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: static member C23.M : x:'a * y:'b -> Two, static member C23.M : x:'a * y:int -> Three
3+
4+
E_OneTypeVariable03.fsx(61,34,61,45): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: static member C123.M : x:'a * y:'a -> One, static member C123.M : x:'a * y:'b -> Two, static member C123.M : x:'a * y:int -> Three
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// #Regression #TypeInference
2+
// Regression test for FSHARP1.0:4758
3+
// Type Inference
4+
// Check Method Disambiguation When User Generic Variable Get Instantiated By Overload Resolution
5+
6+
// These different return types are used to determine which overload got chosen
7+
type One = | One
8+
type Two = | Two
9+
type Three = | Three
10+
type Four = | Four
11+
12+
// An unsealed type
13+
type C() =
14+
member x.P = 1
15+
16+
type C1 =
17+
static member M<'a>(x:'a,y:'a) = One
18+
19+
type C2 =
20+
static member M<'a,'b>(x:'a,y:'b) = Two
21+
22+
type C3 =
23+
static member M<'a>(x:'a,y:int) = Three
24+
25+
type C4 =
26+
static member M<'a>(x:'a,y:C) = Four
27+
28+
type C12 =
29+
static member M<'a>(x:'a,y:'a) = One
30+
static member M<'a,'b>(x:'a,y:'b) = Two
31+
32+
type C23 =
33+
static member M<'a,'b>(x:'a,y:'b) = Two
34+
static member M<'a>(x:'a,y:int) = Three
35+
36+
type C13 =
37+
static member M<'a>(x:'a,y:'a) = One
38+
static member M<'a>(x:'a,y:int) = Three
39+
40+
type C14 =
41+
static member M<'a>(x:'a,y:'a) = One
42+
static member M<'a>(x:'a,y:C) = Four
43+
44+
type C24 =
45+
static member M<'a,'b>(x:'a,y:'b) = Two
46+
static member M<'a>(x:'a,y:C) = Four
47+
48+
type C123 =
49+
static member M<'a>(x:'a,y:'a) = One
50+
static member M<'a,'b>(x:'a,y:'b) = Two
51+
static member M<'a>(x:'a,y:int) = Three
52+
53+
type C1234 =
54+
static member M<'a>(x:'a,y:'a) = One
55+
static member M<'a,'b>(x:'a,y:'b) = Two
56+
static member M<'a>(x:'a,y:int) = Three
57+
static member M<'a>(x:'a,y:C) = Four
58+
59+
module M3 =
60+
let gB23 (x:'a) (y:int) = C23.M(x,y) // expect: ambiguity error
61+
let gB123 (x:'a) (y:int) = C123.M(x,y) // expect: ambiguous on 2,3
62+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
E_OneTypeVariable03rec.fsx(60,38,60,48): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: static member C23.M : x:'a * y:'b -> Two, static member C23.M : x:'a * y:int -> Three
3+
4+
E_OneTypeVariable03rec.fsx(61,38,61,49): typecheck error FS0041: A unique overload for method 'M' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: static member C123.M : x:'a * y:'a -> One, static member C123.M : x:'a * y:'b -> Two, static member C123.M : x:'a * y:int -> Three

0 commit comments

Comments
 (0)