Trellis

Scala code knowledge graph

Scala source becomes a graph of types, methods, calls, imports, and inheritance, so you can move from a type to what it calls and what it extends without reading the whole repository first.

Trellis reads .scala files. It parses source. It does not include a Scala compiler, a JVM, a classpath, or a TASTy reader, and it does not compile or run Scala. Worksheet files ending in .sc are not included.

What you can follow

package com.acme.users

import com.acme.Service

trait Factory

class User extends Factory {
  def save() = service.run()
}

class Child extends Base[Int] with pkg.Parent[String]

com.acme.users is the package. User is not named com.acme.users.User.

User, a class, implements the local trait Factory. The source word is extends.

User.save calls run. That call is a recorded candidate, not proof that the program was compiled or that a runtime target was resolved.

The file imports com.acme.Service as an external target, not as a file in the repository.

Base can connect when exactly one local type has that name. pkg.Parent stays unresolved. The last segment is not used as a guess.

service.run with no argument list is not a call. service.run() is.

Limits

  • No extension methods.
  • No given or using definitions, and no implicit definitions.
  • No export, and no package object, as a symbol.
  • An enum case is not its own class. The enum declaration is the class.
  • derives and uses do not add a parent.
  • A constructor named this is not a symbol. A def, val, var, or type nested inside a method or function is not a symbol.
  • A pattern is a symbol only when it is a single name or a comma-separated list of names.
  • Package names stay on the package. They are not copied onto other symbols. A later package clause does not inherit an earlier one.
  • Imports stay external targets. They are not resolved to a file.
  • A new expression, an operator used as the thing being called, and a string interpolator are not calls.
  • A member of an anonymous new body is not a member of the enclosing type, and a call inside that body is not attributed to the enclosing method.
  • Methods that share one owner and one name are one method, not one node per signature.
  • Trellis does not add a new kind of node, relationship, or label for Scala, and it does not migrate an existing graph.
  • Trellis does not detect framework routes in Scala.