Skip to content

Scaladoc: Minimize casting between public and compiler API #13371

Closed
@pikinier20

Description

@pikinier20

In some places of Scaladoc we need to cast members of public API into compiler API to get more information. We can try to expose necessary elements of compiler API in public API to minimize casting.

Things missing in public API:

  • TypeRepr.isTupleType (see Add TypeRepr.isTupleN to reflection API #13384)
  • Position.exists
  • TypeRepr.isCompiletimeAppliedType
  • TypeRepr.memberInfo(sym: Symbol) <- equivalent of Type.memberInfo(sym: Symbol)
  • Method which returns all supertypes of class
  • Method which returns all members of Symbol
  • Method which returns TypeRepr of ClassDef

There are also some fishy pieces of code that should probably be removed:

  • We need to filter out some methods by matching Strings: s.name.contains("$super$") , ".*\\$default\\$\\d+$".r.matches(s.name). There's no flags set to filter these methods, maybe we should add Synthetic flag or expose some API to be able to filter them out.
  • There's currently no way to disambiguate constructor with empty param list and constructor without param list: for DefDef.paramss both return List(List()). Currently we hack this check using positions.

It's probably a good time to do the changes now to add them to 3.1.0.

@smarter
@nicolasstucki
@romanowski

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions