You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A generic result builder with a buildExpression that locks uses these generics must still constrain the buildBlock against those same generics when it reaches a certain complexity.
To Reproduce
I've tried to create a minimal repro, though it may minimize a little further.
protocolP0<A0,A1>{associatedtypeA0associatedtypeA1func f(_ a0:A0, _ a1:A1)}structS0<A0,A1>:P0{func f(_ a0:A0, _ a1:A1){}}@resultBuilderenumB<A0,A1>{staticfunc buildExpression<T:P0<A0,A1>>(_ expression:T)->T{ expression }staticfunc buildPartialBlock<R>(first:R)->R{ first }staticfunc buildPartialBlock<R0:P0,R1:P0<R0.A0,R0.A1>>(
accumulated:R0, next:R1)->someP0<R0.A0,R0.A1>// Commenting the next line in gets things building,// even though it should be inferred via 'buildExpression'// where R0.A0 == A0, R1.A1 == A1{
accumulated
}}structS1<B0>{}enumE1<B0,B1>{}protocolP1{associatedtypeB0vars1:S1<B0>{getset}}protocolP2{associatedtypeB0associatedtypeB1staticfunc e1(_:E1<B0,B1>)->Self}extensionP0where
A0:P1,
A1:P2,
A0.B0 ==A1.B0{func g<GReturnValue:P0>(@B<GReturnValue.A0,GReturnValue.A1> build:()->GReturnValue)->someP0<A0,A1>where
GReturnValue.A0 ==A0.B0,
GReturnValue.A1 ==A1.B1{S0()}}structS2:P0{structA0:P1{vars1:S1<T0>}enumA1:P2{case e1(E1<T0,T1>)}structT0{}enumT1{}func f(_ a0:A0, _ a1:A1){}}@B<S2.A0,S2.A1>varp:someP0<S2.A0,S2.A1>{S0<S2.A0,S2.A1>().g{// error: Generic parameter 'GReturnValue' could not be inferredS0<S2.T0,S2.T1>()S0<S2.T0,S2.T1>()}}
Expected behavior
I expect the above to build without specifying the generic constraints on buildPartialBlock(accumulated:next:).
Environment (please complete the following information):
Xcode 14 (Swift 5.7 Development Snapshot 2022-06-13 (a))
The text was updated successfully, but these errors were encountered:
stephencelis
added
the
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
label
Jun 19, 2022
Describe the bug
A generic result builder with a
buildExpression
that locks uses these generics must still constrain thebuildBlock
against those same generics when it reaches a certain complexity.To Reproduce
I've tried to create a minimal repro, though it may minimize a little further.
Expected behavior
I expect the above to build without specifying the generic constraints on
buildPartialBlock(accumulated:next:)
.Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: