Skip to content

Impossible to use TypeRepr#memberType #15643

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

Open
rskfocus opened this issue Jul 10, 2022 · 1 comment
Open

Impossible to use TypeRepr#memberType #15643

rskfocus opened this issue Jul 10, 2022 · 1 comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:bug

Comments

@rskfocus
Copy link

rskfocus commented Jul 10, 2022

Compiler version

3.1.3

Minimized code

/* this definitions are supposed to be equal, isn't it? */
val repr: TypeRepr = ...
val alsoRepr: TypeRepr = repr.memberType(repr.typeSymbol)

/* but this assertion is failing! */
assert(repr =:= alsoRepr)

/* and even trying to `show` it is impossible */
alsoRepr.show // scala.MatchError: ClassInfo(ThisType(...))

Expectation

My macro uses Symbol#tree in a few places and it works, but I'm noticed that there is a warning in documentation that suggest replacing it with tp.memberType(symbol).

Not only it doesn't work, but it is quite confusing what tp should be.

Why isn't it a static method such as TypeRepr.memberType(symbol)?

@rskfocus rskfocus added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 10, 2022
@rochala
Copy link
Contributor

rochala commented Jul 11, 2022

Related to #13319
#15159

@mbovel mbovel added area:metaprogramming:reflection Issues related to the quotes reflection API and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:reflection Issues related to the quotes reflection API itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants