Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve the annoying C with AnyRef problem with contexts #14

Closed
LPTK opened this issue Aug 4, 2017 · 1 comment
Closed

Solve the annoying C with AnyRef problem with contexts #14

LPTK opened this issue Aug 4, 2017 · 1 comment
Assignees

Comments

@LPTK
Copy link
Member

LPTK commented Aug 4, 2017

Sometimes one still encounters annoying errors saying a context should be C with AnyRef instead of just C.
This basically happens when using constructs that return IR[T,{}], such as Const(123) because Const is defined as [T: IRType](v: T): IR[T,{}]. For example:

def foo[C](x: IR[Int, C]): IR[Int, C] = ir"$x + ${Const(123)}"

This code fails to compile with:

Error:(37, 56) type mismatch;
 found   : squid.TestDSL.IR[Int,AnyRef with C]
 required: squid.TestDSL.Predef.IR[Int,C]
    (which expands to)  squid.TestDSL.IR[Int,C]
    def foo[C](x: IR[Int, C]): IR[Int, C] = ir"$x + ${Const(123)}"
@LPTK LPTK self-assigned this Aug 4, 2017
@LPTK
Copy link
Member Author

LPTK commented Aug 4, 2017

Solved in https://github.com/epfldata/sc/commit/3c4f3fa91f0e336d3f3eed6f2662b2cbb3f2cf47

We now remove AnyRef types from inferred contexts.

Using {} for the empty context is debatable (though it does look better than Any), but at least now it should cause far fewer problems.

@LPTK LPTK closed this as completed Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant