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

Add tasty.reflect.utils #5685

Merged
merged 1 commit into from
Jan 17, 2019
Merged

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Jan 8, 2019

With implementation of def let(rhs: Term)(in: Term.Ident => Term): Term.


This version allows sealing terms even if the type is not statically known while keeping the type safety guarantees on quoted expressions.

Added reflective tpe on quoted.Expr[T] to get its quoted.Type[T] even when T is just an existential type.

Added asExprOf to cast an Expr[_] to an Expr[U]. Fails if the expression is not a subtype of U.


Use asExprOf[T] when needed.

With implementation of `def let(rhs: Term)(in: Term.Ident => Term): Term`
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except that the repeated usage of seal.asExprOf suggests that we should keep a short-cut API for friendliness.

@nicolasstucki
Copy link
Contributor Author

Actually the current definition of tpe is unsound.

@nicolasstucki
Copy link
Contributor Author

I removed the alternative to #5651 which was unsound. The solution will be an improvement on sealing types that will be needed but we can work around it for now with casts.

@liufengyun liufengyun merged commit b4a26ca into scala:master Jan 17, 2019
@liufengyun liufengyun deleted the add-tasty-utils branch January 17, 2019 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants