Skip to content

Commit 5a91e91

Browse files
author
dotnet-automerge-bot
authored
Merge pull request #7154 from dotnet/merges/release/dev16.3-to-release/fsharp47
Merge release/dev16.3 to release/fsharp47
2 parents 2c95ddd + 28ef31d commit 5a91e91

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

  • src/fsharp/FSharp.Core
  • tests/fsharp/core/queriesLeafExpressionConvert

src/fsharp/FSharp.Core/Linq.fs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,12 @@ module LeafExpressionConverter =
735735
Expression.Lambda(dty, bodyP, vsP) |> asExpr
736736

737737
| Patterns.NewTuple args ->
738-
let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType
738+
let tupTy =
739+
let argTypes = args |> List.map (fun arg -> arg.Type) |> Array.ofList
740+
if inp.Type.IsValueType then
741+
Reflection.FSharpType.MakeStructTupleType(inp.Type.Assembly, argTypes)
742+
else
743+
Reflection.FSharpType.MakeTupleType(argTypes)
739744
let argsP = ConvExprsToLinq env args
740745
let rec build ty (argsP: Expression[]) =
741746
match Reflection.FSharpValue.PreComputeTupleConstructorInfo ty with

tests/fsharp/core/queriesLeafExpressionConvert/test.fsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,24 @@ module LeafExpressionEvaluationTests =
146146
checkEval "2ver9ewrx" (<@ (1,2,3,4,5,6,7,8,9,10) @>) (1,2,3,4,5,6,7,8,9,10)
147147
checkEval "2ver9ewrc" (<@ (1,2,3,4,5,6,7,8,9,10,11) @>) (1,2,3,4,5,6,7,8,9,10,11)
148148
checkEval "2ver9ewrv" (<@ (1,2,3,4,5,6,7,8,9,10,11,12) @>) (1,2,3,4,5,6,7,8,9,10,11,12)
149+
150+
151+
check "2ver9ewrsf" (let v2 = struct(3,4) in Eval <@ v2 @>) struct(3,4)
152+
153+
check "2ver9ewrsg" (let v2 = struct(3,4) in Eval <@ struct(v2,v2) @>) struct(struct(3,4),struct(3,4))
154+
155+
checkEval "2ver9ewrst" (<@ struct(1,2) @>) struct(1,2)
156+
checkEval "2ver9ewvsk" (<@ struct(1,2,3) @>) struct(1,2,3)
157+
checkEval "2ver9ewrsh" (<@ struct(1,2,3,4) @>) struct(1,2,3,4)
158+
checkEval "2ver9ewrsj" (<@ struct(1,2,3,4,5) @>) struct(1,2,3,4,5)
159+
checkEval "2ver9ewrsk" (<@ struct(1,2,3,4,5,6) @>) struct(1,2,3,4,5,6)
160+
checkEval "2ver9ewrsl" (<@ struct(1,2,3,4,5,6,7) @>) struct(1,2,3,4,5,6,7)
161+
checkEval "2ver9ewrsa" (<@ struct(1,2,3,4,5,6,7,8) @>) struct(1,2,3,4,5,6,7,8)
162+
checkEval "2ver9ewrss" (<@ struct(1,2,3,4,5,6,7,8,9) @>) struct(1,2,3,4,5,6,7,8,9)
163+
checkEval "2ver9ewrsx" (<@ struct(1,2,3,4,5,6,7,8,9,10) @>) struct(1,2,3,4,5,6,7,8,9,10)
164+
checkEval "2ver9ewrsc" (<@ struct(1,2,3,4,5,6,7,8,9,10,11) @>) struct(1,2,3,4,5,6,7,8,9,10,11)
165+
checkEval "2ver9ewrsv" (<@ struct(1,2,3,4,5,6,7,8,9,10,11,12) @>) struct(1,2,3,4,5,6,7,8,9,10,11,12)
166+
149167
checkEval "2ver9ewrb" (<@ System.DateTime.Now.DayOfWeek @>) System.DateTime.Now.DayOfWeek
150168
checkEval "2ver9ewrn" (<@ Checked.(+) 1 1 @>) 2
151169
checkEval "2ver9ewrm" (<@ Checked.(-) 1 1 @>) 0

0 commit comments

Comments
 (0)