Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC FS-1124 - Interfaces with static abstract methods #13119

Merged
merged 126 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 100 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
3814613
WIP: Support implementing statics in interfaces
vzarytovskii May 9, 2022
ff0deda
Cleanup (#13113)
dsyme May 9, 2022
7ce8b63
Revert "Cleanup (#13113)"
vzarytovskii May 10, 2022
adade8a
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 10, 2022
baef7c4
WIP
vzarytovskii May 11, 2022
a84bd24
Merge 'main'
vzarytovskii May 13, 2022
44ae728
Removed double check for non-abstract interface
vzarytovskii May 16, 2022
f2c2e48
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 18, 2022
1d9c753
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 18, 2022
f2d160a
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 18, 2022
e91659d
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 19, 2022
b36215a
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 20, 2022
ebe1050
WIP
vzarytovskii May 20, 2022
5cf713c
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 25, 2022
c200abd
WIP
vzarytovskii May 25, 2022
6762674
Merge remote-tracking branch 'upstream/main' into statics-in-interfac…
vzarytovskii May 27, 2022
2168e1e
WIP
vzarytovskii May 30, 2022
c91c73f
WIP
vzarytovskii Jun 3, 2022
747e8f1
Merge remote-tracking branch 'origin/main' into statics-in-interfaces-2
vzarytovskii Jun 13, 2022
8b31c82
WIP: Fixed method codegen
vzarytovskii Jun 13, 2022
470952e
Merge branch 'main' into statics-in-interfaces-2
vzarytovskii Jun 13, 2022
40916ee
Fixes to style + indent
vzarytovskii Jun 13, 2022
92fdf2a
After merge fixes
vzarytovskii Jun 13, 2022
f74ecf2
WIP: add language and runtime feature
vzarytovskii Jun 14, 2022
018bfd0
Fixed feature guard
vzarytovskii Jun 16, 2022
810a51f
Fixed the immediate members filter
vzarytovskii Jun 17, 2022
15178c8
Merge branch 'main' into statics-in-interfaces-2
vzarytovskii Jun 20, 2022
9e86055
Fix tests baselines
vzarytovskii Jun 20, 2022
d2e96c7
Fix tests baselines
vzarytovskii Jun 20, 2022
c0aac06
fix for list pattern syntax
vzarytovskii Jun 20, 2022
82a079e
Added operators tests
vzarytovskii Jun 20, 2022
e6ad912
allow authoring and fix abstract slot inference
dsyme Jun 22, 2022
be1909c
add tests
dsyme Jun 23, 2022
7546888
Merge pull request #2 from dsyme/statics-in-interfaces-2
vzarytovskii Jun 23, 2022
7262f1f
fix build
dsyme Jun 23, 2022
9b00827
Merge branch 'statics-in-interfaces-2' of https://github.com/vzarytov…
dsyme Jun 23, 2022
aa03f82
Update surface area tests
vzarytovskii Jun 24, 2022
a6b7118
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jun 24, 2022
6122923
Apply fantomas
vzarytovskii Jun 24, 2022
b512c93
add call syntax and emit constrained prefix
dsyme Jun 24, 2022
d4504db
Merge pull request #3 from dsyme/statics-in-interfaces-2
vzarytovskii Jun 27, 2022
3355110
fix parsing problems, allow invocation and support name resolution of…
dsyme Jun 28, 2022
8520647
merge main
dsyme Jun 28, 2022
cc574a8
merge main
dsyme Jun 28, 2022
aeade7a
fix from-end-slicing
dsyme Jun 28, 2022
85e3997
Self constraints; Disallow ^T; Full test matrix for propery SRTP cons…
dsyme Jun 29, 2022
c038f9c
update samples
dsyme Jun 29, 2022
74a996d
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jun 30, 2022
7dcd465
fix tests
dsyme Jun 30, 2022
273e206
git first execution test working
dsyme Jun 30, 2022
b2f8c28
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jun 30, 2022
13fa09b
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jul 1, 2022
555fbbe
update formating
dsyme Jul 1, 2022
1fe8d22
merge and fix test
dsyme Jul 3, 2022
4b983f0
merge main
dsyme Jul 4, 2022
3874fa5
fix tests
dsyme Jul 4, 2022
28bea4a
fix tests
dsyme Jul 4, 2022
3432f30
allow IWSAM constraints to solve SRTP traits
dsyme Jul 4, 2022
ce57d10
fix to signature compat
dsyme Jul 4, 2022
a864274
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jul 4, 2022
fb8b75c
format code
dsyme Jul 4, 2022
b33b80b
fix task tests
dsyme Jul 5, 2022
de6ec1a
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jul 5, 2022
243c207
fix test
dsyme Jul 5, 2022
09f7f17
fix up tests
dsyme Jul 6, 2022
4200b5e
fix test
dsyme Jul 6, 2022
13b97fc
add warnings to match RFC
dsyme Jul 6, 2022
7eeae6d
update messages and protect changes
dsyme Jul 6, 2022
7f6a46d
clear static req for inference variables
dsyme Jul 6, 2022
01f6ec4
clear static req for inference variables
dsyme Jul 6, 2022
9f9c49a
fix another case of generalization
dsyme Jul 6, 2022
d0544e4
fix build
dsyme Jul 6, 2022
8438abd
fix formatting
dsyme Jul 6, 2022
1b71be2
Merge branch 'main' of https://github.com/dotnet/fsharp into statics-…
dsyme Jul 6, 2022
aa5820a
fix tests
dsyme Jul 6, 2022
87e1304
fix tests
dsyme Jul 7, 2022
03f7bef
add tests and improve diagnostics
dsyme Jul 7, 2022
7ee7e07
format code
dsyme Jul 7, 2022
ab95b72
fix tests
dsyme Jul 7, 2022
a254a88
add more quickinfo etc tests
dsyme Jul 7, 2022
19a4934
clean up tests
dsyme Jul 8, 2022
d6da718
Merge branch 'main' into statics-in-interfaces-2
dsyme Jul 11, 2022
79ae597
merge main
dsyme Jul 11, 2022
c9e6284
format code
dsyme Jul 11, 2022
6df8a34
fix build
dsyme Jul 11, 2022
a5d56a3
merge main
dsyme Jul 11, 2022
9d33a53
Update LanguageFeatures.fs
dsyme Jul 11, 2022
e36b205
merge main
dsyme Jul 11, 2022
fb50126
merge main
dsyme Jul 11, 2022
5aaa9a1
fix build
dsyme Jul 11, 2022
6c783a7
Moved tests/adhoc to ComponentTests
0101 Jul 13, 2022
cb21cef
Updated new syntax test
0101 Jul 14, 2022
aaf86b7
Updated new syntax test
0101 Jul 14, 2022
ef8fecf
Disabling failing tests for now
0101 Jul 14, 2022
218f9ee
Fix new SRTP instance method invocation
0101 Jul 14, 2022
1ac2e27
Func conversion tests, renaming
0101 Jul 15, 2022
22aa7d5
Verify IL for IWSAM test
0101 Jul 15, 2022
c464aef
Byref tests
0101 Jul 15, 2022
aa8b80a
Test creating delegates to IWSAM-constrained target methods
0101 Jul 18, 2022
6145058
Tests for implicit conversion and nominal type in constraint selector
0101 Jul 19, 2022
1a3bb71
IWSAM active patterns tests
0101 Jul 27, 2022
9e760a6
Test for C# using IWSAM defined in F#
0101 Jul 27, 2022
ce3aa0d
Release IL in test
0101 Jul 27, 2022
6681e16
Merge branch 'main' into statics-in-interfaces-2
0101 Jul 27, 2022
8b8427a
Fix test
0101 Jul 27, 2022
bc8d9b8
Skip IWSAM tests on NET FW
0101 Jul 28, 2022
86d3552
merge main
dsyme Aug 1, 2022
ed56f7e
fix build
dsyme Aug 1, 2022
143045d
fix build
dsyme Aug 1, 2022
881d431
fix test
dsyme Aug 1, 2022
2ae12a5
fix inference tests
dsyme Aug 1, 2022
4605e77
Updated type inference tests
0101 Aug 1, 2022
5b2c6e2
Merge branch 'statics-in-interfaces-2' of github.com:vzarytovskii/fsh…
0101 Aug 1, 2022
7b96494
Fix compiler generated attribute for setters
0101 Aug 1, 2022
23f0c61
Prepared System.Numerics suppression test
0101 Aug 1, 2022
5c404c0
Sample project for .NET 7
0101 Aug 1, 2022
ef3ae6c
fix byref arguments to trait calls
dsyme Aug 1, 2022
c700443
fix byref arguments to trait calls
dsyme Aug 1, 2022
80f1833
Added more samples, fixed compiler paths for VS
vzarytovskii Aug 2, 2022
c59553a
DirectoryAttribute puts each test into its own directory
0101 Aug 2, 2022
713416a
Merge branch 'statics-in-interfaces-2' of github.com:vzarytovskii/fsh…
0101 Aug 2, 2022
540ba37
Only add extra dir for test if there multiple tests processed by Dire…
0101 Aug 2, 2022
3fbcb5d
Moved adhoc byref tests to actual tests
0101 Aug 2, 2022
a76d013
Tests update
0101 Aug 2, 2022
3a847d8
Merge branch 'main' into statics-in-interfaces-2
0101 Aug 3, 2022
5629ef4
Merge branch 'main' into statics-in-interfaces-2
vzarytovskii Aug 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"internalConsoleOptions": "neverOpen",
"suppressJITOptimizations": true,
"stopAtEntry": false,
"justMyCode": false,
"justMyCode": true,
"enableStepFiltering": true,
"symbolOptions": {
"searchMicrosoftSymbolServer": true,
Expand Down Expand Up @@ -73,7 +73,7 @@
"enabled": true
}
},
"justMyCode": false,
"justMyCode": true,
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
"enableStepFiltering": false,
}
]
Expand Down
8 changes: 7 additions & 1 deletion VisualFSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Test.Utilities", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{60D275B0-B14A-41CB-A1B2-E815A7448FCB}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpSuite.Tests", "tests\fsharp\FSharpSuite.Tests.fsproj", "{C163E892-5BF7-4B59-AA99-B0E8079C67C4}"
ProjectSection(ProjectDependencies) = postProject
{37EB3E54-ABC6-4CF5-8273-7CE4B61A42C1} = {37EB3E54-ABC6-4CF5-8273-7CE4B61A42C1}
{511C95D9-3BA6-451F-B6F8-F033F40878A5} = {511C95D9-3BA6-451F-B6F8-F033F40878A5}
{597D9896-4B90-4E9E-9C99-445C2CB9FF60} = {597D9896-4B90-4E9E-9C99-445C2CB9FF60}
{E54456F4-D51A-4334-B225-92EBBED92B40} = {E54456F4-D51A-4334-B225-92EBBED92B40}
EndProjectSection
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}"
EndProject
Expand Down Expand Up @@ -149,8 +155,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service", "
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service.Tests", "tests\FSharp.Compiler.Service.Tests\FSharp.Compiler.Service.Tests.fsproj", "{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA}"
ProjectSection(ProjectDependencies) = postProject
{FF76BD3C-5E0A-4752-B6C3-044F6E15719B} = {FF76BD3C-5E0A-4752-B6C3-044F6E15719B}
{887630A3-4B1D-40EA-B8B3-2D842E9C40DB} = {887630A3-4B1D-40EA-B8B3-2D842E9C40DB}
{FF76BD3C-5E0A-4752-B6C3-044F6E15719B} = {FF76BD3C-5E0A-4752-B6C3-044F6E15719B}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualFSharpDebug", "vsintegration\Vsix\VisualFSharpFull\VisualFSharpDebug.csproj", "{A422D673-8E3B-4924-821B-DD3174173426}"
Expand Down
38 changes: 22 additions & 16 deletions src/Compiler/AbstractIL/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ type ILInstr =

| I_call of ILTailcall * ILMethodSpec * ILVarArgs
| I_callvirt of ILTailcall * ILMethodSpec * ILVarArgs
| I_callconstraint of ILTailcall * ILType * ILMethodSpec * ILVarArgs
| I_callconstraint of callvirt: bool * ILTailcall * ILType * ILMethodSpec * ILVarArgs
| I_calli of ILTailcall * ILCallingSignature * ILVarArgs
| I_ldftn of ILMethodSpec
| I_newobj of ILMethodSpec * ILVarArgs
Expand Down Expand Up @@ -3409,9 +3409,6 @@ let mkNormalCall mspec = I_call(Normalcall, mspec, None)

let mkNormalCallvirt mspec = I_callvirt(Normalcall, mspec, None)

let mkNormalCallconstraint (ty, mspec) =
I_callconstraint(Normalcall, ty, mspec, None)

let mkNormalNewobj mspec = I_newobj(mspec, None)

/// Comment on common object cache sizes:
Expand Down Expand Up @@ -3821,18 +3818,24 @@ let mkILClassCtor impl =
let mk_ospec (ty: ILType, callconv, nm, genparams, formal_args, formal_ret) =
OverridesSpec(mkILMethRef (ty.TypeRef, callconv, nm, genparams, formal_args, formal_ret), ty)

let mkILGenericVirtualMethod (nm, access, genparams, actual_args, actual_ret, impl) =
let mkILGenericVirtualMethod (nm, callconv: ILCallingConv, access, genparams, actual_args, actual_ret, impl) =
let attributes =
convertMemberAccess access
||| MethodAttributes.CheckAccessOnOverride
||| (match impl with
| MethodBody.Abstract -> MethodAttributes.Abstract ||| MethodAttributes.Virtual
| _ -> MethodAttributes.Virtual)
||| (if callconv.IsInstance then
enum 0
else
MethodAttributes.Static)

ILMethodDef(
name = nm,
attributes =
(convertMemberAccess access
||| MethodAttributes.CheckAccessOnOverride
||| (match impl with
| MethodBody.Abstract -> MethodAttributes.Abstract ||| MethodAttributes.Virtual
| _ -> MethodAttributes.Virtual)),
attributes = attributes,
implAttributes = MethodImplAttributes.Managed,
genericParams = genparams,
callingConv = ILCallingConv.Instance,
callingConv = callconv,
parameters = actual_args,
ret = actual_ret,
isEntryPoint = false,
Expand All @@ -3841,8 +3844,11 @@ let mkILGenericVirtualMethod (nm, access, genparams, actual_args, actual_ret, im
body = notlazy impl
)

let mkILNonGenericVirtualMethod (nm, access, args, ret, impl) =
mkILGenericVirtualMethod (nm, access, mkILEmptyGenericParams, args, ret, impl)
let mkILNonGenericVirtualMethod (nm, callconv, access, args, ret, impl) =
vzarytovskii marked this conversation as resolved.
Show resolved Hide resolved
mkILGenericVirtualMethod (nm, callconv, access, mkILEmptyGenericParams, args, ret, impl)

let mkILNonGenericVirtualInstanceMethod (nm, access, args, ret, impl) =
mkILNonGenericVirtualMethod (nm, ILCallingConv.Instance, access, args, ret, impl)

let mkILGenericNonVirtualMethod (nm, access, genparams, actual_args, actual_ret, impl) =
ILMethodDef(
Expand Down Expand Up @@ -4266,7 +4272,7 @@ let mkILDelegateMethods access (ilg: ILGlobals) (iltyp_AsyncCallback, iltyp_IAsy

let one nm args ret =
let mdef =
mkILNonGenericVirtualMethod (nm, access, args, mkILReturn ret, MethodBody.Abstract)
mkILNonGenericVirtualInstanceMethod (nm, access, args, mkILReturn ret, MethodBody.Abstract)

mdef.WithAbstract(false).WithHideBySig(true).WithRuntime(true)

Expand Down Expand Up @@ -5297,7 +5303,7 @@ and refsOfILInstr s x =
| I_callvirt (_, mr, varargs) ->
refsOfILMethodSpec s mr
refsOfILVarArgs s varargs
| I_callconstraint (_, tr, mr, varargs) ->
| I_callconstraint (_, _, tr, mr, varargs) ->
refsOfILType s tr
refsOfILMethodSpec s mr
refsOfILVarArgs s varargs
Expand Down
9 changes: 6 additions & 3 deletions src/Compiler/AbstractIL/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ type internal ILInstr =
// Method call
| I_call of ILTailcall * ILMethodSpec * ILVarArgs
| I_callvirt of ILTailcall * ILMethodSpec * ILVarArgs
| I_callconstraint of ILTailcall * ILType * ILMethodSpec * ILVarArgs
| I_callconstraint of callvirt: bool * ILTailcall * ILType * ILMethodSpec * ILVarArgs
| I_calli of ILTailcall * ILCallingSignature * ILVarArgs
| I_ldftn of ILMethodSpec
| I_newobj of ILMethodSpec * ILVarArgs
Expand Down Expand Up @@ -1975,7 +1975,6 @@ type internal ILLocalsAllocator =
/// Derived functions for making some common patterns of instructions.
val internal mkNormalCall: ILMethodSpec -> ILInstr
val internal mkNormalCallvirt: ILMethodSpec -> ILInstr
val internal mkNormalCallconstraint: ILType * ILMethodSpec -> ILInstr
val internal mkNormalNewobj: ILMethodSpec -> ILInstr
val internal mkCallBaseConstructor: ILType * ILType list -> ILInstr list
val internal mkNormalStfld: ILFieldSpec -> ILInstr
Expand Down Expand Up @@ -2030,12 +2029,16 @@ val internal mkILNonGenericStaticMethod:
string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef

val internal mkILGenericVirtualMethod:
string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef
string * ILCallingConv * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody ->
ILMethodDef

val internal mkILGenericNonVirtualMethod:
string * ILMemberAccess * ILGenericParameterDefs * ILParameter list * ILReturn * MethodBody -> ILMethodDef

val internal mkILNonGenericVirtualMethod:
string * ILCallingConv * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef

val internal mkILNonGenericVirtualInstanceMethod:
string * ILMemberAccess * ILParameter list * ILReturn * MethodBody -> ILMethodDef

val internal mkILNonGenericInstanceMethod:
Expand Down
3 changes: 2 additions & 1 deletion src/Compiler/AbstractIL/ilmorph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ let morphILTypesInILInstr ((factualTy, fformalTy)) i =
| I_calli (a, mref, varargs) -> I_calli(a, callsig_ty2ty factualTy mref, morphILVarArgs factualTy varargs)
| I_call (a, mr, varargs) -> I_call(a, conv_mspec mr, morphILVarArgs factualTy varargs)
| I_callvirt (a, mr, varargs) -> I_callvirt(a, conv_mspec mr, morphILVarArgs factualTy varargs)
| I_callconstraint (a, ty, mr, varargs) -> I_callconstraint(a, factualTy ty, conv_mspec mr, morphILVarArgs factualTy varargs)
| I_callconstraint (callvirt, a, ty, mr, varargs) ->
I_callconstraint(callvirt, a, factualTy ty, conv_mspec mr, morphILVarArgs factualTy varargs)
| I_newobj (mr, varargs) -> I_newobj(conv_mspec mr, morphILVarArgs factualTy varargs)
| I_ldftn mr -> I_ldftn(conv_mspec mr)
| I_ldvirtftn mr -> I_ldvirtftn(conv_mspec mr)
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/AbstractIL/ilprint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -893,11 +893,11 @@ let rec goutput_instr env os inst =
output_string os "callvirt "
goutput_vararg_mspec env os (mspec, varargs)
output_after_tailcall os tl
| I_callconstraint (tl, ty, mspec, varargs) ->
| I_callconstraint (callvirt, tl, ty, mspec, varargs) ->
output_tailness os tl
output_string os "constraint. "
goutput_typ env os ty
output_string os " callvirt "
output_string os (if callvirt then " callvirt " else " call")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check: is spacing correct here? It's "callvirt" but "_call"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

goutput_vararg_mspec env os (mspec, varargs)
output_after_tailcall os tl
| I_castclass ty ->
Expand Down
22 changes: 14 additions & 8 deletions src/Compiler/AbstractIL/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -626,17 +626,23 @@ let instrs () =
i_stsfld, I_field_instr(volatilePrefix (fun x fspec -> I_stsfld(x, fspec)))
i_ldflda, I_field_instr(noPrefixes I_ldflda)
i_ldsflda, I_field_instr(noPrefixes I_ldsflda)
i_call, I_method_instr(tailPrefix (fun tl (mspec, y) -> I_call(tl, mspec, y)))
(i_call,
I_method_instr(
constraintOrTailPrefix (fun (c, tl) (mspec, y) ->
match c with
| Some ty -> I_callconstraint(false, tl, ty, mspec, y)
| None -> I_call(tl, mspec, y))
))
i_ldftn, I_method_instr(noPrefixes (fun (mspec, _y) -> I_ldftn mspec))
i_ldvirtftn, I_method_instr(noPrefixes (fun (mspec, _y) -> I_ldvirtftn mspec))
i_newobj, I_method_instr(noPrefixes I_newobj)
i_callvirt,
I_method_instr(
constraintOrTailPrefix (fun (c, tl) (mspec, y) ->
match c with
| Some ty -> I_callconstraint(tl, ty, mspec, y)
| None -> I_callvirt(tl, mspec, y))
)
(i_callvirt,
I_method_instr(
constraintOrTailPrefix (fun (c, tl) (mspec, y) ->
match c with
| Some ty -> I_callconstraint(true, tl, ty, mspec, y)
| None -> I_callvirt(tl, mspec, y))
))
i_leave_s, I_unconditional_i8_instr(noPrefixes (fun x -> I_leave x))
i_br_s, I_unconditional_i8_instr(noPrefixes I_br)
i_leave, I_unconditional_i32_instr(noPrefixes (fun x -> I_leave x))
Expand Down
5 changes: 3 additions & 2 deletions src/Compiler/AbstractIL/ilreflect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,9 +1485,10 @@ let rec emitInstr cenv (modB: ModuleBuilder) emEnv (ilG: ILGenerator) instr =
emitSilverlightCheck ilG
emitInstrCall cenv emEnv ilG OpCodes.Callvirt tail mspec varargs

| I_callconstraint (tail, ty, mspec, varargs) ->
| I_callconstraint (callvirt, tail, ty, mspec, varargs) ->
ilG.Emit(OpCodes.Constrained, convType cenv emEnv ty)
emitInstrCall cenv emEnv ilG OpCodes.Callvirt tail mspec varargs
let instr = if callvirt then OpCodes.Callvirt else OpCodes.Call
emitInstrCall cenv emEnv ilG instr tail mspec varargs

| I_calli (tail, callsig, None) ->
emitInstrTail cenv ilG tail (fun () ->
Expand Down
5 changes: 3 additions & 2 deletions src/Compiler/AbstractIL/ilwrite.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1919,10 +1919,11 @@ module Codebuf =
emitTailness cenv codebuf tl
emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs)
//emitAfterTailcall codebuf tl
| I_callconstraint (tl, ty, mspec, varargs) ->
| I_callconstraint (callvirt, tl, ty, mspec, varargs) ->
emitTailness cenv codebuf tl
emitConstrained cenv codebuf env ty
emitMethodSpecInstr cenv codebuf env i_callvirt (mspec, varargs)
let instr = if callvirt then i_callvirt else i_call
emitMethodSpecInstr cenv codebuf env instr (mspec, varargs)
//emitAfterTailcall codebuf tl
| I_newobj (mspec, varargs) ->
emitMethodSpecInstr cenv codebuf env i_newobj (mspec, varargs)
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Checking/CheckComputationExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhol
match info with
| None -> false
| Some args ->
args |> List.exists (fun (isParamArrayArg, _isInArg, isOutArg, optArgInfo, _callerInfo, _reflArgInfo) -> isParamArrayArg || isOutArg || optArgInfo.IsOptional))
args |> List.exists (fun (ParamAttribs(isParamArrayArg, _isInArg, isOutArg, optArgInfo, _callerInfo, _reflArgInfo)) -> isParamArrayArg || isOutArg || optArgInfo.IsOptional))
else
false

Expand Down
Loading