Skip to content

Conversation

@DarkDimius
Copy link
Contributor

Currently saves on all classfiles in the same compilation unit.
@odersky, feel free to take over

@xeno-by
Copy link

xeno-by commented Apr 24, 2015

So if there are multiple classes in the same file, the same attribute will be written multiple times? Also, how is this supposed to be accessible at runtime?

@DarkDimius
Copy link
Contributor Author

So if there are multiple classes in the same file, the same attribute will be written multiple times?

This should be fixed by either having a single top-level class per compilation unit after pickler, or pickler should prepare a map of what TASTY to save in which file.

Also, how is this supposed to be accessible at runtime?

Given this implementation, only using classloader.

This implementation is not thought as a long-term one, but to foster testing of TASTY in Dotty.
I would propose to discuss how should actual implementation look like on next TASTY meeting.

If a unit has several top-level classes or object (which are not linked classes
of each other) each gets its own pickle information, which contains
any enclosing package clauses and imports and then just the top-level
class/object and its companion object.
@odersky
Copy link
Contributor

odersky commented Apr 24, 2015

@DarkDimius Please review.

odersky added 4 commits April 25, 2015 10:08
It does not matter whether it comes from Dotty or elsewhere. We can record the
name of the producer in a section of the format itself.
If a constructor for class C was called with wrong number of parameters,
the previous error message referred to `method <init>`. Now it is
`constructor C`.
Classfile parser now reads TASTY attributes or annotations and
unpickles them in order to allow for separate compilation.
Add test-classes to .gitignore. (The change is produced persistently by my Eclipse IDE).
@xeno-by
Copy link

xeno-by commented Apr 25, 2015

I pulled this PR together with #495 into master, then compiled Dotty, then ran it on a simple file, and it blew up. No idea whether I'm doing something wrong, or it's a genuine bug, but here's the log:

16:48 ~/Projects/dotty/sandbox (flatmap2015)$ cat Test.scala
class C {
  def x = 42
  def y = x
}
16:49 ~/Projects/dotty/sandbox (flatmap2015)$ dotc -Ytest-pickler Test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: denotation module class <empty> invalid in run 2. ValidFor: Period(1..4, run = 3)
    at scala.Predef$.assert(Predef.scala:165)
    at dotty.tools.dotc.core.Denotations$SingleDenotation.bringForward(Denotations.scala:508)
    at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:544)
    at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:370)
    at dotty.tools.dotc.core.SymDenotations$class.stillValid(SymDenotations.scala:49)
    at dotty.tools.dotc.core.Contexts$Context.stillValid(Contexts.scala:51)
    at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1220)
    at dotty.tools.dotc.core.Types$NamedType.denotAt(Types.scala:1206)
    at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1194)
    at dotty.tools.dotc.ast.Trees$DenotingTree.denot(Trees.scala:270)
    at dotty.tools.dotc.ast.Trees$Tree.symbol(Trees.scala:187)
    at dotty.tools.dotc.ast.tpd$modsDeco.mods(tpd.scala:399)
    at dotty.tools.dotc.printing.RefinedPrinter$$anonfun$toText$2.apply(RefinedPrinter.scala:393)
    at dotty.tools.dotc.printing.RefinedPrinter$$anonfun$toText$2.apply(RefinedPrinter.scala:159)
    at dotty.tools.dotc.printing.PlainPrinter.controlled(PlainPrinter.scala:22)
    at dotty.tools.dotc.printing.RefinedPrinter.toText(RefinedPrinter.scala:159)

DarkDimius added a commit that referenced this pull request Apr 28, 2015
Save TASTY in attribute of classfiles.
@DarkDimius DarkDimius merged commit 6d1138e into scala:master Apr 28, 2015
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.

3 participants