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

Merge main to release/dev16.8 #10085

Merged
merged 1 commit into from
Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 7 additions & 8 deletions src/fsharp/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3080,20 +3080,20 @@ and GenUntupledArgsDiscardingLoneUnit cenv cgbuf eenv m numObjArgs curriedArgInf
GenExpr cenv cgbuf eenv SPSuppress arg2 discard
| _ ->
(curriedArgInfos, args) ||> List.iter2 (fun argInfos x ->
GenUntupledArgExpr cenv cgbuf eenv m argInfos x Continue)
GenUntupledArgExpr cenv cgbuf eenv m argInfos x)

/// Codegen arguments
and GenUntupledArgExpr cenv cgbuf eenv m argInfos expr sequel =
and GenUntupledArgExpr cenv cgbuf eenv m argInfos expr =
let g = cenv.g
let numRequiredExprs = List.length argInfos
assert (numRequiredExprs >= 1)
if numRequiredExprs = 1 then
GenExpr cenv cgbuf eenv SPSuppress expr sequel
if numRequiredExprs = 0 then
()
elif numRequiredExprs = 1 then
GenExpr cenv cgbuf eenv SPSuppress expr Continue
elif isRefTupleExpr expr then
let es = tryDestRefTupleExpr expr
if es.Length <> numRequiredExprs then error(InternalError("GenUntupledArgExpr (2)", m))
es |> List.iter (fun x -> GenExpr cenv cgbuf eenv SPSuppress x Continue)
GenSequel cenv eenv.cloc cgbuf sequel
else
let ty = tyOfExpr g expr
let locv, loce = mkCompGenLocal m "arg" ty
Expand All @@ -3104,7 +3104,6 @@ and GenUntupledArgExpr cenv cgbuf eenv m argInfos expr sequel =
let tys = destRefTupleTy g ty
assert (tys.Length = numRequiredExprs)
argInfos |> List.iteri (fun i _ -> GenGetTupleField cenv cgbuf eenvinner (tupInfoRef, loce, tys, i, m) Continue)
GenSequel cenv eenv.cloc cgbuf sequel
)


Expand Down Expand Up @@ -3224,7 +3223,7 @@ and GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel =
// static extension method with empty arguments.
| [[]], [_] when numObjArgs = 0 -> 0
// instance extension method with empty arguments.
| [[_];[]], [_;_] when numObjArgs = 1 -> 0
| [[_];[]], [_;_] when numObjArgs = 0 -> 1
| _ -> numMethodArgs
else numMethodArgs

Expand Down
6 changes: 6 additions & 0 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,12 @@ module TypecheckTests =
peverify cfg "pos36-srtp-app.exe"
exec cfg ("." ++ "pos36-srtp-app.exe") ""

[<Test>]
let ``sigs pos38`` () =
let cfg = testConfig' "typecheck/sigs"
fsc cfg "%s --target:library -o:pos38.dll --warnaserror" cfg.fsc_flags ["pos38.fs"]
peverify cfg "pos38.dll"

[<Test>]
let ``sigs pos23`` () =
let cfg = testConfig' "typecheck/sigs"
Expand Down
28 changes: 28 additions & 0 deletions tests/fsharp/typecheck/sigs/pos38.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module Pos38

type Expression =
| EndOp
| BinaryOp of Expression * Expression

let mutable count = 0

[<AutoOpen>]
module Extensions =

type Expression with

member this.Foobar2 : unit =
match this with
| BinaryOp (_, e2) ->
e2.Foobar2
| EndOp ->
count <- count + 1
()


let c = BinaryOp(EndOp, EndOp)

c.Foobar2

if count <> 1 then failwith "incorrect count"