Skip to content
Snippets Groups Projects
Commit e615288e authored by Mirco Dotta's avatar Mirco Dotta
Browse files

Fixed bug in arbitrary function used to link Scala AST Type element to its...

Fixed bug in arbitrary function used to link Scala AST Type element to its Arbitrary function for generating arbitrary object of the data Type.
parent cac67ec7
No related branches found
No related tags found
No related merge requests found
...@@ -366,12 +366,14 @@ trait ScalaCheck extends FreshNameCreator { ...@@ -366,12 +366,14 @@ trait ScalaCheck extends FreshNameCreator {
*/ */
def apply(generator: Tree): Tree = apply(select(moduleSym, "apply"), generator) def apply(generator: Tree): Tree = apply(select(moduleSym, "apply"), generator)
def arbitrary(tpe: Type): Tree = tpe match { def arbitrary(tpe: Type): Tree = tpe2arbApp.get(tpe) match {
//case TypeRef(_,sym,List(p)) if p.prefix == NoPrefix => tpe2arbApp.get(tpe).get case Some(arbTree) => arbTree
case TypeRef(_,sym,List(p)) => apply(arbitrary(sym.typeConstructor), arbitrary(p)) case None =>
case tpe => tpe2arbApp.get(tpe).get val TypeRef(_,sym,params) = tpe
apply(arbitrary(sym.typeConstructor), params.map(arbitrary(_)))
} }
/** /**
* *
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment