reactiveneo icon indicating copy to clipboard operation
reactiveneo copied to clipboard

type mismatch in complex return expressions

Open Moinheart opened this issue 9 years ago • 5 comments

I try to use Reactiveneo like this referred in README.md:

(TestNode( _.name := "Tom" ) :->: TestRelationship() :<-: TestNode()) .returns { case t1 ~~ r ~~ t2 ~~ _ => t1}

but there is a compile error in returns method:

type mismatch, expected: (PatternLink[TestNode, PatternLink[TestRelationship, PatternLink[TestNode, PNil]]]) => ReturnExpression[NotInferedURT], actual: (PatternLink[TestNode, PatternLink[TestRelationship, PatternLink[TestNode, PNil]]]) => GraphObject[GO, _]

and when i write returns { case t1 ~~ r ~~ t2 ~~ _ => r} or returns { case t1 ~~ r ~~ t2 ~~ _ => t2}, the error msg is:

type mismatch, expected: (PatternLink[TestNode, PatternLink[TestRelationship, PatternLink[TestNode, PNil]]]) => ReturnExpression[NotInferedURT], actual: (PatternLink[TestNode, PatternLink[TestRelationship, PatternLink[TestNode, PNil]]]) => Pattern

Could you help me solve this problem?

Moinheart avatar Jan 08 '16 03:01 Moinheart

it seems that the function of chaining returns is not supported yet.

Moinheart avatar Jan 11 '16 01:01 Moinheart

Hi @Moinheart,

I think we don't support chaining properly yet, or some implicits are missing, the only thing that's off is the return type of the construct but the hierarchy is well defined. @bjankie1 this is your territory, any suggestions here?

Regards, Flavian

alexflav23 avatar Jan 11 '16 12:01 alexflav23

I'm looking into that.

Regards, Bartosz

On Mon, 11 Jan 2016 at 13:48 Flavian Alexandru [email protected] wrote:

Hi @Moinheart https://github.com/Moinheart,

I think we don't support chaining properly yet, or some implicits are missing, the only thing that's off is the return type of the construct but the hierarchy is well defined. @bjankie1 https://github.com/bjankie1 this is your territory, any suggestions here?

Regards, Flavian

— Reply to this email directly or view it on GitHub https://github.com/websudos/reactiveneo/issues/20#issuecomment-170537251 .

bjankie1 avatar Jan 12 '16 20:01 bjankie1

The easiest way to resolve it for now is to instruct Scala to apply certain order of operators:

returns { case (t1 ~~ (r ~~ t2)) => r} I think reactiveneo code could be improved by changing ~~ to an operator that takes the correct precedence.

Regards, Bartosz

On Tue, 12 Jan 2016 at 21:59 Bartosz Jankiewicz < [email protected]> wrote:

I'm looking into that.

Regards, Bartosz

On Mon, 11 Jan 2016 at 13:48 Flavian Alexandru [email protected] wrote:

Hi @Moinheart https://github.com/Moinheart,

I think we don't support chaining properly yet, or some implicits are missing, the only thing that's off is the return type of the construct but the hierarchy is well defined. @bjankie1 https://github.com/bjankie1 this is your territory, any suggestions here?

Regards, Flavian

— Reply to this email directly or view it on GitHub https://github.com/websudos/reactiveneo/issues/20#issuecomment-170537251 .

bjankie1 avatar Jan 12 '16 21:01 bjankie1

@bjankie1 the first solution that you suggest doesn't work in the test case. And how to modify object ~~ to an operator? I've read the code and attempted to do it, but not in the right way. Could you give me more details of it or help fix it perhaps? Thanks for your suggestions in this issue.

Moinheart avatar Jan 15 '16 01:01 Moinheart