Skip to content
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

Test case for new typeclass derivation scheme #6531

Merged
merged 35 commits into from
Jun 4, 2019
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2b1ec55
New test case
odersky May 17, 2019
844c5d7
Fix widenAbstractTypes
odersky May 18, 2019
d5c5c11
Special treatment for Singletons
odersky May 18, 2019
6fda1f3
Fix printer bug
odersky May 19, 2019
c30af3c
Add desugar Printer
odersky May 20, 2019
3617cba
Add deriving.Mirror infrastructure
odersky May 20, 2019
42807da
Add isGenericProduct test
odersky May 20, 2019
5829928
Synthesis for mirror infrastructure
odersky May 20, 2019
c6c0f71
Rename SyntheticMethods -> SyntheticMembers
odersky May 20, 2019
5c924ca
Mirror infrastructure for generic sum types
odersky May 20, 2019
159c883
Refine isGenericSum condition
odersky May 21, 2019
88cec9f
Always generate companion objects for sealed classes
odersky May 21, 2019
4cccf41
Revert "Always generate companion objects for sealed classes"
odersky May 21, 2019
c031b30
Make enum cases implement Mirror.Singleton
odersky May 21, 2019
9120105
Add Mirror.Singleton to enum cases after typer
odersky May 21, 2019
ed79907
Refactor special case handling in implicit arguments
odersky May 21, 2019
f898fc1
Add new utility method: withAttachment
odersky May 22, 2019
934c4ad
Use attachment to mark singleton cases
odersky May 22, 2019
be1a063
Synthesize implicits for product and sum mirrors
odersky May 22, 2019
275a0a9
Generate sum mirrors for sealed traits that do not have a companion
odersky May 22, 2019
e50a032
Use Label field for sum and product mirrors
odersky May 22, 2019
eda4232
Synthesize mirrors also for Scala 2 defined classes and objects
odersky May 22, 2019
f24e247
Polishings
odersky May 22, 2019
7583adc
Avoid name clashes by prefixing all type members with Mirrored
odersky May 22, 2019
4784e2f
Update typeclass-scaling data using old Generic scheme
odersky May 23, 2019
a87b42b
Measure typeclass scaling using new scheme
odersky May 23, 2019
56c0f96
Drop old deriving infrastructure
odersky May 23, 2019
01d3ff7
Make scheme work also for nested classes and companion objects
odersky May 23, 2019
6d3c2f9
Don't constrain MirroredElemTypes to be a subtype of Tuple
odersky May 24, 2019
c02861f
Introduce MirroredTypeConstructor
odersky May 24, 2019
930ca64
Avoid widening derived instances too far
milessabin Jun 2, 2019
91df766
Generalized type class derivation for higher kinded type classes
milessabin Jun 2, 2019
ddb0c4c
Renamed elemTypes to elemsType
milessabin Jun 4, 2019
bf67516
MirroredMonoType -> MirroredType in comment
milessabin Jun 4, 2019
2afa89c
Removed redundant case and inlined RHSs
milessabin Jun 4, 2019
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
Next Next commit
Fix printer bug
The recovery after a `summarized` was wrong, which meant that
after a first print summarized we'd always print in summarized mode,
writing lots of "...".
odersky authored and milessabin committed May 30, 2019
commit 6fda1f30499d0d16b8b391eca200f217e6dc342e
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
@@ -547,7 +547,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
val saved = maxSummarized
maxSummarized = ctx.base.toTextRecursions + depth
try op
finally maxSummarized = depth
finally maxSummarized = saved
}

def summarized[T](op: => T): T = summarized(summarizeDepth)(op)
3 changes: 1 addition & 2 deletions tests/run/typeclass-derivation2d.scala
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ object Deriving {
type MirrorOf[T] = Mirror { type MonoType = T }
type ProductMirrorOf[T] = Mirror.Product { type MonoType = T }
type SumMirrorOf[T] = Mirror.Sum { type MonoType = T }
type SingletonMirror = Mirror.Singleton

object Mirror {

@@ -369,7 +368,7 @@ object Show {
inline def showCase(x: Any, m: ProductMirrorOf[_]): String = {
val label = constValue[m.CaseLabel]
inline m match {
case m: SingletonMirror => label
case m: Mirror.Singleton => label
case _ => showElems[m.ElemTypes, m.ElemLabels](0)(x).mkString(s"$label(", ", ", ")")
}
}