Skip to content

Commit 0d8433e

Browse files
committed
make tests pass
1 parent ea810bd commit 0d8433e

File tree

4 files changed

+108
-28
lines changed

4 files changed

+108
-28
lines changed

tests/service/ExprTests.fs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,24 @@ let ``Check use of type provider that provides calls to F# code`` () =
689689
for line in d |> printDeclaration None do
690690
yield line ]
691691
results |> shouldEqual
692-
["type TestProject"; "type AssemblyInfo"; "type TestProject"; "type T";
693-
"type Class1";
694-
"member .ctor(unitVar0) = (Object..ctor (); ()) @ (5,5--5,11)";
695-
"""member get_X(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in Helper.doNothing () @ (6,20--6,35)""" ]
696-
692+
["type TestProject"; "type AssemblyInfo"; "type TestProject"; "type T";
693+
"""type Class1""";
694+
"""member .ctor(unitVar0) = (Object..ctor (); ()) @ (5,5--5,11)""";
695+
"""member get_X1(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in Helper.doNothing () @ (6,21--6,36)""";
696+
"""member get_X2(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in Helper.doNothingGeneric<Microsoft.FSharp.Core.int> (3) @ (7,21--7,43)""";
697+
"""member get_X3(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in Helper.doNothingOneArg (3) @ (8,21--8,42)""";
698+
"""member get_X4(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in C.DoNothing () @ (9,21--9,41)""";
699+
"""member get_X5(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in C.DoNothingGeneric<Microsoft.FSharp.Core.int> (3) @ (10,21--10,48)""";
700+
"""member get_X6(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in C.DoNothingOneArg (3) @ (11,21--11,47)""";
701+
"""member get_X7(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in C.DoNothingTwoArg (new C(),3) @ (12,21--12,47)""";
702+
"""member get_X8(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in new C().InstanceDoNothing() @ (13,21--13,49)""";
703+
"""member get_X9(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in new C().InstanceDoNothingGeneric<Microsoft.FSharp.Core.int>(3) @ (14,21--14,56)""";
704+
"""member get_X10(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in new C().InstanceDoNothingOneArg(3) @ (15,22--15,56)""";
705+
"""member get_X11(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in new C().InstanceDoNothingTwoArg(new C(),3) @ (16,22--16,56)""";
706+
"""member get_X12(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in G`1<Microsoft.FSharp.Core.int>.DoNothing () @ (17,22--17,49)""";
707+
"""member get_X13(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in G`1<Microsoft.FSharp.Core.int>.DoNothingOneArg (3) @ (18,22--18,55)""";
708+
"""member get_X14(this) (unitVar1) = let this: Microsoft.FSharp.Core.obj = ("My internal state" :> Microsoft.FSharp.Core.obj) :> ErasedWithConstructor.Provided.MyType in G`1<Microsoft.FSharp.Core.int>.DoNothingTwoArg (new C(),3) @ (19,22--19,55)"""]
709+
697710

698711
#if SELF_HOST_STRESS
699712

tests/service/TestProject/Library.fs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,20 @@
33
type T = ErasedWithConstructor.Provided.MyType
44

55
type Class1() =
6-
member this.X = T().DoNothing()
6+
member this.X1 = T().DoNothing()
7+
member this.X2 = T().DoNothingGeneric()
8+
member this.X3 = T().DoNothingOneArg()
9+
member this.X4 = T().ClassDoNothing()
10+
member this.X5 = T().ClassDoNothingGeneric()
11+
member this.X6 = T().ClassDoNothingOneArg()
12+
member this.X7 = T().ClassDoNothingTwoArg()
13+
member this.X8 = T().ClassInstanceDoNothing()
14+
member this.X9 = T().ClassInstanceDoNothingGeneric()
15+
member this.X10 = T().ClassInstanceDoNothingOneArg()
16+
member this.X11 = T().ClassInstanceDoNothingTwoArg()
17+
member this.X12 = T().GenericClassDoNothing()
18+
member this.X13 = T().GenericClassDoNothingOneArg()
19+
member this.X14 = T().GenericClassDoNothingTwoArg()
20+
21+
22+

tests/service/TestProject/TestProject.fsproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<ItemGroup>
4646
<Compile Include="AssemblyInfo.fs" />
4747
<Compile Include="Library.fs" />
48-
<None Include="Script.fsx" />
4948
</ItemGroup>
5049
<ItemGroup>
5150
<ProjectReference Include="..\TestTP\TestTP.fsproj">

tests/service/TestTP/Library.fs

Lines changed: 73 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,80 @@ type BasicProvider (config : TypeProviderConfig) as this =
5151
myType.AddMember(innerState)
5252

5353
let someMethod = ProvidedMethod("DoNothing", [], typeof<unit>,
54-
InvokeCode = fun args -> <@@ Helper.doNothing();
55-
Helper.doNothingOneArg(3)
56-
Helper.doNothingGeneric(3)
57-
Helper.C.DoNothing()
58-
Helper.C.DoNothingGeneric(3)
59-
Helper.C.DoNothingOneArg(3)
60-
Helper.C.DoNothingTwoArg(Helper.C(), 3)
61-
Helper.C().InstanceDoNothing()
62-
Helper.C().InstanceDoNothingGeneric(3)
63-
Helper.C().InstanceDoNothingOneArg(3)
64-
Helper.C().InstanceDoNothingTwoArg(Helper.C(), 3)
65-
Helper.G<int>.DoNothing()
66-
// These do not seem to compile correctly when used in provided expressions:
67-
//Helper.G<int>.DoNothingGeneric(3)
68-
Helper.G<int>.DoNothingOneArg(3)
69-
Helper.G<int>.DoNothingTwoArg(Helper.C(), 3)
70-
Helper.G<int>().InstanceDoNothing()
71-
// These do not seem to compile correctly when used in provided expressions:
72-
//Helper.G<int>().InstanceDoNothingGeneric(3)
73-
Helper.G<int>().InstanceDoNothingOneArg(3)
74-
Helper.G<int>().InstanceDoNothingTwoArg(Helper.C(), 3) @@>)
54+
InvokeCode = fun args -> <@@ Helper.doNothing() @@>)
55+
myType.AddMember(someMethod)
56+
57+
let someMethod = ProvidedMethod("DoNothingOneArg", [], typeof<unit>,
58+
InvokeCode = fun args -> <@@ Helper.doNothingOneArg(3) @@>)
59+
myType.AddMember(someMethod)
60+
61+
let someMethod = ProvidedMethod("DoNothingGeneric", [], typeof<unit>,
62+
InvokeCode = fun args -> <@@ Helper.doNothingGeneric(3) @@>)
63+
myType.AddMember(someMethod)
64+
65+
let someMethod = ProvidedMethod("ClassDoNothing", [], typeof<unit>,
66+
InvokeCode = fun args -> <@@ Helper.C.DoNothing() @@>)
67+
myType.AddMember(someMethod)
68+
69+
let someMethod = ProvidedMethod("ClassDoNothingGeneric", [], typeof<unit>,
70+
InvokeCode = fun args -> <@@ Helper.C.DoNothingGeneric(3) @@>)
71+
72+
myType.AddMember(someMethod)
73+
74+
let someMethod = ProvidedMethod("ClassDoNothingOneArg", [], typeof<unit>,
75+
InvokeCode = fun args -> <@@ Helper.C.DoNothingOneArg(3) @@>)
76+
77+
myType.AddMember(someMethod)
78+
79+
let someMethod = ProvidedMethod("ClassDoNothingTwoArg", [], typeof<unit>,
80+
InvokeCode = fun args -> <@@ Helper.C.DoNothingTwoArg(Helper.C(), 3) @@>)
81+
myType.AddMember(someMethod)
82+
83+
let someMethod = ProvidedMethod("ClassInstanceDoNothing", [], typeof<unit>,
84+
InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothing() @@>)
85+
myType.AddMember(someMethod)
86+
87+
let someMethod = ProvidedMethod("ClassInstanceDoNothingGeneric", [], typeof<unit>,
88+
InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingGeneric(3) @@>)
89+
myType.AddMember(someMethod)
90+
91+
let someMethod = ProvidedMethod("ClassInstanceDoNothingOneArg", [], typeof<unit>,
92+
InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingOneArg(3) @@>)
93+
myType.AddMember(someMethod)
94+
95+
let someMethod = ProvidedMethod("ClassInstanceDoNothingTwoArg", [], typeof<unit>,
96+
InvokeCode = fun args -> <@@ Helper.C().InstanceDoNothingTwoArg(Helper.C(), 3) @@>)
97+
myType.AddMember(someMethod)
98+
99+
let someMethod = ProvidedMethod("GenericClassDoNothing", [], typeof<unit>,
100+
InvokeCode = fun args -> <@@ Helper.G<int>.DoNothing() @@>)
101+
myType.AddMember(someMethod)
102+
103+
// These do not seem to compile correctly when used in provided expressions:
104+
//Helper.G<int>.DoNothingGeneric(3)
105+
106+
// These do not seem to compile correctly when used in provided expressions:
107+
//Helper.G<int>().InstanceDoNothingGeneric(3)
108+
109+
let someMethod = ProvidedMethod("GenericClassDoNothingOneArg", [], typeof<unit>,
110+
InvokeCode = fun args -> <@@ Helper.G<int>.DoNothingOneArg(3) @@>)
111+
myType.AddMember(someMethod)
112+
113+
let someMethod = ProvidedMethod("GenericClassDoNothingTwoArg", [], typeof<unit>,
114+
InvokeCode = fun args -> <@@ Helper.G<int>.DoNothingTwoArg(Helper.C(), 3) @@>)
115+
myType.AddMember(someMethod)
116+
117+
let someMethod = ProvidedMethod("GenericClassInstanceDoNothing", [], typeof<unit>,
118+
InvokeCode = fun args -> <@@ Helper.G<int>().InstanceDoNothing() @@>)
119+
myType.AddMember(someMethod)
120+
121+
122+
let someMethod = ProvidedMethod("GenericClassInstanceDoNothingOneArg", [], typeof<unit>,
123+
InvokeCode = fun args -> <@@ Helper.G<int>().InstanceDoNothingOneArg(3) @@>)
124+
myType.AddMember(someMethod)
75125

126+
let someMethod = ProvidedMethod("GenericClassInstanceDoNothingTwoArg", [], typeof<unit>,
127+
InvokeCode = fun args -> <@@ Helper.G<int>().InstanceDoNothingTwoArg(Helper.C(), 3) @@>)
76128
myType.AddMember(someMethod)
77129

78130
[myType]

0 commit comments

Comments
 (0)