Skip to content

Commit

Permalink
Move mixin compositions out of worksheets
Browse files Browse the repository at this point in the history
Mixin compositions take long to compile, and apparently that slows down
operating with the worksheets - see scala-ide/scala-worksheet#186.
  • Loading branch information
Blaisorblade committed Jul 9, 2014
1 parent 8856fe2 commit 10beab8
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 66 deletions.
16 changes: 1 addition & 15 deletions src/test/scala/ilc/feature/let/ANormalFormSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@ package let
import org.scalatest._

class ANormalFormSpec extends FlatSpec with Instantiations {
def buildBacchusSystem(doCSE_ : Boolean, copyPropagation_ : Boolean, partialApplicationsAreSpecial_ : Boolean) =
new language.Bacchus with let.ANormalFormAdapter with integers.ImplicitSyntaxSugar
with integers.Evaluation with let.Evaluation with let.Pretty
with inference.LetInference
with BetaReduction with inference.LetSyntaxSugar with inference.InferenceTestHelper {
outer =>
val aNormalizer = new ANormalFormStateful {
val mySyntax: outer.type = outer
override val doCSE = doCSE_
override val copyPropagation = copyPropagation_
override val partialApplicationsAreSpecial = partialApplicationsAreSpecial_
}
}

def tests(doCSE_ : Boolean, copyPropagation_ : Boolean, partialApplicationsAreSpecial_ : Boolean) {
val bacchusSystem = buildBacchusSystem(doCSE_, copyPropagation_, partialApplicationsAreSpecial_)
val bacchusSystem = buildBacchusWithLetSystem(doCSE_, copyPropagation_, partialApplicationsAreSpecial_)
import bacchusSystem._
import aNormalizer.{doCSE, copyPropagation, partialApplicationsAreSpecial}

Expand Down
34 changes: 10 additions & 24 deletions src/test/scala/ilc/feature/let/ANormalFormTest.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ package ilc
package feature
package let

object ANormalFormTest {
import language._
val v = new Bacchus with let.ANormalFormAdapter with integers.ImplicitSyntaxSugar with inference.LetInference
with BetaReduction with Pretty// with AddCaches
//with inference.SyntaxSugar //Or with:
with inference.LetSyntaxSugar {
outer =>
val aNormalizer = new feature.let.ANormalFormStateful {
val mySyntax: outer.type = outer
}
} //> v : ilc.language.Bacchus with ilc.feature.let.ANormalFormAdapter with ilc.f
//| eature.integers.ImplicitSyntaxSugar with ilc.feature.inference.LetInference
//| with ilc.feature.let.BetaReduction with ilc.feature.let.Pretty with ilc.feat
//| ure.inference.LetSyntaxSugar{val aNormalizer: ilc.feature.let.ANormalFormSta
//| teful{val mySyntax: ilc.feature.let.ANormalFormTest.<refinement>.type}} = il
//| c.feature.let.ANormalFormTest$$anonfun$main$1$$anon$1@df61ca
//Both work, but the output is different.

//def tests(v: Bacchus with feature.let.ANormalFormStateful with integers.ImplicitSyntaxSugar with inference.LetInference
//with BetaReduction) {
object ANormalFormTest extends WorksheetHelpers {
val v = buildBacchusWithLetSystem(true, true, true)
//> v : ilc.language.Bacchus with ilc.feature.let.ANormalFormAdapter with ilc.f
//| eature.integers.ImplicitSyntaxSugar with ilc.feature.integers.Evaluation wit
//| h ilc.feature.let.Evaluation with ilc.feature.let.Pretty with ilc.feature.in
//| ference.LetInference with ilc.feature.let.BetaReduction with ilc.feature.inf
//| erence.LetSyntaxSugar with ilc.feature.inference.InferenceTestHelper{val aNo
//| rmalizer: ilc.feature.let.ANormalFormStateful{val mySyntax: ilc.feature.let.
//| Instantiations.<refinement>.type}} = ilc.feature.let.Instantiations$$anon$1@
//| 2cfd88b5
import v._

//Taken from http://matt.might.net/articles/a-normalization/, but was ill-typed!
Expand Down Expand Up @@ -209,8 +199,4 @@ object ANormalFormTest {
//| a_13
//| a_14;
//| a_15"
//"\n" + pretty(addCaches(test3))
//"\n" + pretty(addCaches(test1))
//}
//tests(v)
}
34 changes: 34 additions & 0 deletions src/test/scala/ilc/feature/let/Instantiations.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package ilc
package feature
package let

trait Instantiations {
def buildBacchusWithLetSystem(doCSE_ : Boolean, copyPropagation_ : Boolean, partialApplicationsAreSpecial_ : Boolean) =
new language.Bacchus with let.ANormalFormAdapter with integers.ImplicitSyntaxSugar
with integers.Evaluation with let.Evaluation with let.Pretty
with inference.LetInference
with BetaReduction with inference.LetSyntaxSugar with inference.InferenceTestHelper {
outer =>
val aNormalizer = new ANormalFormStateful {
val mySyntax: outer.type = outer
override val doCSE = doCSE_
override val copyPropagation = copyPropagation_
override val partialApplicationsAreSpecial = partialApplicationsAreSpecial_
}
}

def buildBaseBacchus() =
new language.Bacchus with integers.ImplicitSyntaxSugar with inference.LetInference
with BetaReduction with Pretty
with products.StdLib
with inference.LetSyntaxSugar

def buildCacher[T <: Syntax with IsAtomic with products.SyntaxSugar with unit.Syntax with Traversals](bacchus: T) =
new AddCaches2 {
val mySyntax: bacchus.type = bacchus
}
}

abstract class WorksheetHelpers extends Instantiations {

}
32 changes: 5 additions & 27 deletions src/test/scala/ilc/feature/let/StaticCaching.sc
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,14 @@ package let

import language._

object StaticCaching {
val v = new Bacchus with integers.ImplicitSyntaxSugar with inference.LetInference
with BetaReduction with Pretty
with products.StdLib
//with inference.SyntaxSugar //Or with:
with inference.LetSyntaxSugar //> v : ilc.language.Bacchus with ilc.feature.integers.ImplicitSyntaxSugar with
object StaticCaching extends WorksheetHelpers {
val v = buildBaseBacchus() //> v : ilc.language.Bacchus with ilc.feature.integers.ImplicitSyntaxSugar with
//| ilc.feature.inference.LetInference with ilc.feature.let.BetaReduction with
//| ilc.feature.let.Pretty with ilc.feature.products.StdLib with ilc.feature.inf
//| erence.LetSyntaxSugar = ilc.feature.let.StaticCaching$$anonfun$main$1$$anon$
//| 1@7ebd6a19
/*
with let.ANormalFormAdapter {
outer =>
val aNormalizer = new feature.let.ANormalFormStateful {
val mySyntax: outer.type = outer
}
}
*/
//| erence.LetSyntaxSugar = ilc.feature.let.Instantiations$$anon$2@692ed858
import v._
/*
val cacher = new AddCaches {
val mySyntax: v.type = v
}
*/
val cacher = new AddCaches2 {
val mySyntax: v.type = v
} //> cacher : ilc.feature.let.AddCaches2{val mySyntax: ilc.feature.let.StaticCac
//| hing.<refinement>.type} = ilc.feature.let.StaticCaching$$anonfun$main$1$$ano
//| n$2@451d871
val cacher = buildCacher(v) //> cacher : ilc.feature.let.AddCaches2{val mySyntax: ilc.feature.let.Instantia
//| tions.<refinement>.type} = ilc.feature.let.Instantiations$$anon$4@4373e7e5
import cacher._
import aNormalizer._
/*
Expand Down

0 comments on commit 10beab8

Please sign in to comment.