query {if 1 = 2 then select 3};;
System.ArgumentException: Type mismatch when building 'cond': types of true and false branches differ. Expected 'System.Linq.IQueryable`1[Microsoft.FSharp.Core.Unit]', but received type 'System.Linq.IQueryable`1[System.Linq.IQueryable`1[Microsoft.FSharp.Core.Unit]]'.
Parameter name: receivedType
at Microsoft.FSharp.Quotations.PatternsModule.checkTypesSR[a](Type expectedType, Type receivedType, a name, String threeHoleSR)
at Microsoft.FSharp.Quotations.PatternsModule.mkIfThenElse(FSharpExpr e, FSharpExpr t, FSharpExpr f)
at Microsoft.FSharp.Quotations.FSharpExpr.IfThenElse(FSharpExpr guard, FSharpExpr thenExpr, FSharpExpr elseExpr)
at Microsoft.FSharp.Linq.QueryModule.TransInner(CanEliminate canElim, Boolean check, FSharpExpr immutQuery)
at Microsoft.FSharp.Linq.QueryModule.TransInnerApplicative(Boolean check, FSharpExpr source, FSharpVar immutConsumingVar, FSharpExpr immutConsumingExpr)
at Microsoft.FSharp.Linq.QueryModule.TransInner(CanEliminate canElim, Boolean check, FSharpExpr immutQuery)
at Microsoft.FSharp.Linq.QueryModule.TransInnerAndCommit(CanEliminate canElim, Boolean check, FSharpExpr x)
at Microsoft.FSharp.Linq.QueryModule.TransInnerWithFinalConsume(CanEliminate canElim, FSharpExpr immutSource)
at Microsoft.FSharp.Linq.QueryModule.EvalNonNestedInner(CanEliminate canElim, FSharpExpr queryProducingSequence)
at Microsoft.FSharp.Linq.QueryModule.EvalNonNestedOuter(CanEliminate canElim, FSharpExpr tm)
at Microsoft.FSharp.Linq.QueryModule.clo@1730-1.Microsoft-FSharp-Linq-ForwardDeclarations-IQueryMethods-Execute[a,b](FSharpExpr`1 )
at <StartupCode$FSI_0002>.$FSI_0002.main@()
Stopped due to error
Repro steps
Evaluate
in fsi.exe
Expected behavior
works
Actual behavior
Known workarounds
Don't use this particular shape of query