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
(define (domain a (product x y::int))
(define (domain b (product x y::symbol)))
(transform a b)
You get a generated abstract cross domain AToBVisitorTransform with method like this:
abstract fun transformX(node: A.X): B.X
// ^ ^
In both domains the types have the same name but are not identical, so PIG can rightly assume you want to convert A.X. to B.X.
However, if domain b does not have an x type then you won't get a similar method to convert x to anything in the B domain because PIG doens't currently make any assumptions about what the appropriate return type for such a function would be.
It would however be possible to generate an abstract method like this:
fun transformX(node: A.X): B.BNode = ...
And implementations of this function can use covariant return types to narrow the return type of transformX as needed.
(BNode is the generated superclass for all classes in the B domain.)
The text was updated successfully, but these errors were encountered:
Given:
You get a generated abstract cross domain
AToBVisitorTransform
with method like this:In both domains the types have the same name but are not identical, so PIG can rightly assume you want to convert
A.X
. toB.X
.However, if domain
b
does not have anx
type then you won't get a similar method to convertx
to anything in theB
domain because PIG doens't currently make any assumptions about what the appropriate return type for such a function would be.It would however be possible to generate an abstract method like this:
And implementations of this function can use covariant return types to narrow the return type of
transformX
as needed.(
BNode
is the generated superclass for all classes in theB
domain.)The text was updated successfully, but these errors were encountered: