Skip to content

Add standard definitions on Tasty reflect #4895

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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert changes on FromSymbol
  • Loading branch information
nicolasstucki committed Aug 8, 2018
commit a9cd2fef1f61aff62f5d40516016a6402a3fc724
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/tastyreflect/FromSymbol.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package dotty.tools.dotc.tastyreflect

import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Contexts.Context
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.core.StdNames._
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Types._

trait FromSymbol { tasty: TastyImpl =>
object FromSymbol {

def definitionFromSym(sym: Symbol)(implicit ctx: Context): tpd.Tree = {
if (sym.is(Package)) packageDefFromSym(sym)
Expand All @@ -20,7 +21,7 @@ trait FromSymbol { tasty: TastyImpl =>

def packageDefFromSym(sym: Symbol)(implicit ctx: Context): PackageDefinition = PackageDefinitionImpl(sym)

def classDef(cls: ClassSymbol)(implicit ctx: Context): ClassDef = {
def classDef(cls: ClassSymbol)(implicit ctx: Context): tpd.TypeDef = {
val constrSym = cls.unforcedDecls.find(_.isPrimaryConstructor).orElse(
// Dummy constructor for classes such as `<refinement>`
ctx.newSymbol(cls, nme.CONSTRUCTOR, EmptyFlags, NoType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package dotty.tools.dotc.tastyreflect

import dotty.tools.dotc.core.Symbols._

trait StandardDefinitions extends scala.tasty.reflect.StandardDefinitions with FromSymbol {
import dotty.tools.dotc.tastyreflect.FromSymbol._

trait StandardDefinitions extends scala.tasty.reflect.StandardDefinitions {
tasty: TastyImpl =>

private implicit def ctx: Context = rootContext
Expand Down
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/tastyreflect/TastyImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import scala.quoted
import scala.reflect.ClassTag
import scala.tasty.util.{Show, ShowExtractors, ShowSourceCode}

class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty with FromSymbol with StandardDefinitions { self =>
import dotty.tools.dotc.tastyreflect.FromSymbol._

class TastyImpl(val rootContext: Contexts.Context) extends scala.tasty.Tasty with StandardDefinitions { self =>

// ===== Quotes ===================================================

Expand Down