Skip to content

Fix #6585: implement Type.isFunctionType in tasty reflect API #6586

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

Merged
merged 2 commits into from
Jun 3, 2019

Conversation

liufengyun
Copy link
Contributor

Fix #6585: implement Type.isFunctionType in tasty reflect API

* @note `List[Int]` is not a function type, despite that `List[Int] <:< Int => Int`.
*/
def Type_isFunctionType(self: Type)(implicit ctx: Context): Boolean

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The specification of the method may raise some concerns. However, in the setting of meta-programming, this is can be justified, as it's well-known that reflection breaks referential transparency. E.g. 1 + 1 == 2, but '{1 + 1} != '2. For this method, the semantic reasoning breaks at the type level -- an intended effect that's useful in meta-programming.

Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Add the missing checks for implicit and erased functions

@liufengyun liufengyun merged commit 2c26c17 into scala:master Jun 3, 2019
@liufengyun liufengyun deleted the fix-6585 branch June 3, 2019 12:11
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.

Tasty Reflect: add isFunctionType
2 participants