diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-25 08:50:29 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-01-25 08:51:29 -0800 |
commit | 8e7d9313e8923afea89bfba859535b3bee74021c (patch) | |
tree | 37ec7fc360018b67a2b2b0e235bd322a873e74e1 /test/scaladoc | |
parent | b8cb50d4205102573306bb09c26f1fb324b7a81b (diff) | |
parent | 8f1d4a5e5417915d31c4fc8cc22be2ac5925dcc9 (diff) | |
download | scala-8e7d9313e8923afea89bfba859535b3bee74021c.tar.gz scala-8e7d9313e8923afea89bfba859535b3bee74021c.tar.bz2 scala-8e7d9313e8923afea89bfba859535b3bee74021c.zip |
Merge pull request #1931 from danielhopkins/remove-pimping
Small terminology change aimed at improving inclusion.
Diffstat (limited to 'test/scaladoc')
-rw-r--r-- | test/scaladoc/resources/implicits-base-res.scala | 80 | ||||
-rw-r--r-- | test/scaladoc/run/implicits-base.scala | 148 |
2 files changed, 114 insertions, 114 deletions
diff --git a/test/scaladoc/resources/implicits-base-res.scala b/test/scaladoc/resources/implicits-base-res.scala index d6c0332c10..1d17e9a6d3 100644 --- a/test/scaladoc/resources/implicits-base-res.scala +++ b/test/scaladoc/resources/implicits-base-res.scala @@ -11,21 +11,21 @@ trait MyNumeric[R] * - tests the complete type inference * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA(x: Double) // pimpA3: with a constraint that T <: Double - * def convToIntA(x: Int) // pimpA2: with a constraint that T = Int - * def convToManifestA(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double - * def convToMyNumericA(x: T) // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope - * def convToNumericA(x: T) // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope - * def convToPimpedA(x: Bar[Foo[T]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: S) // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED - * def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED - * def convToTraversableOps(x: T) // pimpA7: with 2 constraints: T: Manifest and T <: Double + * def convToGtColonDoubleA(x: Double) // enrichA3: with a constraint that T <: Double + * def convToIntA(x: Int) // enrichA2: with a constraint that T = Int + * def convToManifestA(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double + * def convToMyNumericA(x: T) // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope + * def convToNumericA(x: T) // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope + * def convToEnrichedA(x: Bar[Foo[T]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: S) // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar, SHADOWED + * def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED + * def convToTraversableOps(x: T) // enrichA7: with 2 constraints: T: Manifest and T <: Double * // should not be abstract! * }}} */ class A[T] { - /** This should prevent the implicitly inherited `def convToPimpedA: T` from `pimpA0` from showing up */ - def convToPimpedA(x: T): T = sys.error("Let's check it out!") + /** This should prevent the implicitly inherited `def convToEnrichedA: T` from `enrichA0` from showing up */ + def convToEnrichedA(x: T): T = sys.error("Let's check it out!") /** This should check implicit member elimination in the case of subtyping */ def foo(a: T, b: AnyRef): T } @@ -33,15 +33,15 @@ class A[T] { object A { import language.implicitConversions // according to SIP18 - implicit def pimpA0[V](a: A[V]) = new PimpedA(a) - implicit def pimpA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) - implicit def pimpA2(a: A[Int]) = new IntA(a) - implicit def pimpA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a) - implicit def pimpA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): PimpedA[S] = sys.error("not implemented") - implicit def pimpA5[Z](a: A[Z]): PimpedA[Bar[Foo[Z]]] = sys.error("not implemented") - implicit def pimpA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) + implicit def enrichA0[V](a: A[V]) = new EnrichedA(a) + implicit def enrichA1[ZBUR: Numeric](a: A[ZBUR]) = new NumericA[ZBUR](a) + implicit def enrichA2(a: A[Int]) = new IntA(a) + implicit def enrichA3(a: A[T] forSome { type T <: Double }) = new GtColonDoubleA(a) + implicit def enrichA4[S](a: A[Foo[Bar[S]]])(implicit foo: Foo[S], bar: Bar[S]): EnrichedA[S] = sys.error("not implemented") + implicit def enrichA5[Z](a: A[Z]): EnrichedA[Bar[Foo[Z]]] = sys.error("not implemented") + implicit def enrichA6[Z: MyNumeric](a: A[Z]) = new MyNumericA[Z](a) // TODO: Add H <: Double and see why it crashes for C and D -- context bounds, need to check! - implicit def pimpA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") } + implicit def enrichA7[H <: Double : Manifest](a: A[H]) = new ManifestA[H](a) with MyTraversableOps[H] { def convToTraversableOps(x: H): H = sys.error("no") } } @@ -49,14 +49,14 @@ object A { * - tests the existential type solving * - the following inherited methods should appear: * {{{ - * def convToGtColonDoubleA(x: Double) // pimpA3: no constraints - * def convToManifestA(x: Double) // pimpA7: no constraints - * def convToMyNumericA(x: Double) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope - * def convToNumericA(x: Double) // pimpA1: no constraintsd - * def convToPimpedA(x: Bar[Foo[Double]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED - * def convToTraversableOps(x: Double) // pimpA7: no constraints - * // should not be abstract! + * def convToGtColonDoubleA(x: Double) // enrichA3: no constraints + * def convToManifestA(x: Double) // enrichA7: no constraints + * def convToMyNumericA(x: Double) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + * def convToNumericA(x: Double) // enrichA1: no constraintsd + * def convToEnrichedA(x: Bar[Foo[Double]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED + * def convToTraversableOps(x: Double) // enrichA7: no constraints + * // should not be abstract! * }}} */ class B extends A[Double] @@ -67,11 +67,11 @@ object B extends A * - tests asSeenFrom * - the following inherited methods should appear: * {{{ - * def convToIntA(x: Int) // pimpA2: no constraints - * def convToMyNumericA(x: Int) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope - * def convToNumericA(x: Int) // pimpA1: no constraints - * def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED - * def convToPimpedA(x: Bar[Foo[Int]]) // pimpA5: no constraints, SHADOWED + * def convToIntA(x: Int) // enrichA2: no constraints + * def convToMyNumericA(x: Int) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + * def convToNumericA(x: Int) // enrichA1: no constraints + * def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED + * def convToEnrichedA(x: Bar[Foo[Int]]) // enrichA5: no constraints, SHADOWED * }}} */ class C extends A[Int] @@ -82,10 +82,10 @@ object C extends A * - tests implicit elimination * - the following inherited methods should appear: * {{{ - * def convToMyNumericA(x: String) // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope - * def convToNumericA(x: String) // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope - * def convToPimpedA(x: Bar[Foo[String]]) // pimpA5: no constraints, SHADOWED - * def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED + * def convToMyNumericA(x: String) // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + * def convToNumericA(x: String) // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + * def convToEnrichedA(x: Bar[Foo[String]]) // enrichA5: no constraints, SHADOWED + * def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED * }}} */ class D extends A[String] @@ -93,12 +93,12 @@ class D extends A[String] object D extends A -/** PimpedA class <br/> +/** EnrichedA class <br/> * - tests simple inheritance and asSeenFrom * - A, B and C should be implicitly converted to this */ -class PimpedA[V](a: A[V]) { - /** The convToPimpedA: V documentation... */ - def convToPimpedA(x: V): V = sys.error("Not implemented") +class EnrichedA[V](a: A[V]) { + /** The convToEnrichedA: V documentation... */ + def convToEnrichedA(x: V): V = sys.error("Not implemented") } /** NumericA class <br/> diff --git a/test/scaladoc/run/implicits-base.scala b/test/scaladoc/run/implicits-base.scala index 3d57306f5d..8f8652cdb3 100644 --- a/test/scaladoc/run/implicits-base.scala +++ b/test/scaladoc/run/implicits-base.scala @@ -25,54 +25,54 @@ object Test extends ScaladocModelTest { val A = base._class("A") - // def convToPimpedA(x: T) // pimpA0: with no constraints, SHADOWED - conv = A._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: T) // enrichA0: with no constraints, SHADOWED + conv = A._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "T") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "T") - // def convToNumericA: T // pimpA1: with a constraint that there is x: Numeric[T] implicit in scope - conv = A._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: T // enrichA1: with a constraint that there is x: Numeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToNumericA").resultType.name == "T") - // def convToIntA: Int // pimpA2: with a constraint that T = Int - conv = A._conversion(A.qualifiedName + ".pimpA2") + // def convToIntA: Int // enrichA2: with a constraint that T = Int + conv = A._conversion(A.qualifiedName + ".enrichA2") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToIntA").resultType.name == "Int") - // def convToGtColonDoubleA: Double // pimpA3: with a constraint that T <: Double - conv = A._conversion(A.qualifiedName + ".pimpA3") + // def convToGtColonDoubleA: Double // enrichA3: with a constraint that T <: Double + conv = A._conversion(A.qualifiedName + ".enrichA3") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") - // def convToPimpedA: S // pimpA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar - conv = A._conversion(A.qualifiedName + ".pimpA4") + // def convToEnrichedA: S // enrichA4: with 3 constraints: T = Foo[Bar[S]], S: Foo and S: Bar + conv = A._conversion(A.qualifiedName + ".enrichA4") assert(conv.members.length == 1) assert(conv.constraints.length == 3) - assert(conv._member("convToPimpedA").resultType.name == "S") + assert(conv._member("convToEnrichedA").resultType.name == "S") - // def convToPimpedA: Bar[Foo[T]] // pimpA5: no constraints - conv = A._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[T]] // enrichA5: no constraints + conv = A._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[T]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[T]]") - // def convToMyNumericA: T // pimpA6: with a constraint that there is x: MyNumeric[T] implicit in scope - conv = A._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: T // enrichA6: with a constraint that there is x: MyNumeric[T] implicit in scope + conv = A._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "T") - // def convToManifestA: T // pimpA7: with 2 constraints: T: Manifest and T <: Double - // def convToTraversableOps: T // pimpA7: with 2 constraints: T: Manifest and T <: Double + // def convToManifestA: T // enrichA7: with 2 constraints: T: Manifest and T <: Double + // def convToTraversableOps: T // enrichA7: with 2 constraints: T: Manifest and T <: Double // should not be abstract! - conv = A._conversion(A.qualifiedName + ".pimpA7") + conv = A._conversion(A.qualifiedName + ".enrichA7") assert(conv.members.length == 2) assert(conv.constraints.length == 2) assert(conv._member("convToManifestA").resultType.name == "T") @@ -84,45 +84,45 @@ object Test extends ScaladocModelTest { val B = base._class("B") // these conversions should not affect B - assert(B._conversions(A.qualifiedName + ".pimpA2").isEmpty) - assert(B._conversions(A.qualifiedName + ".pimpA4").isEmpty) + assert(B._conversions(A.qualifiedName + ".enrichA2").isEmpty) + assert(B._conversions(A.qualifiedName + ".enrichA4").isEmpty) - // def convToPimpedA(x: Double) // pimpA0: no constraints, SHADOWED - conv = B._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: Double) // enrichA0: no constraints, SHADOWED + conv = B._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Double") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Double") - // def convToNumericA: Double // pimpA1: no constraintsd - conv = B._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: Double // enrichA1: no constraintsd + conv = B._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToNumericA").resultType.name == "Double") - // def convToGtColonDoubleA: Double // pimpA3: no constraints - conv = B._conversion(A.qualifiedName + ".pimpA3") + // def convToGtColonDoubleA: Double // enrichA3: no constraints + conv = B._conversion(A.qualifiedName + ".enrichA3") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToGtColonDoubleA").resultType.name == "Double") - // def convToPimpedA: Bar[Foo[Double]] // pimpA5: no constraints - conv = B._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[Double]] // enrichA5: no constraints + conv = B._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Double]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Double]]") - // def convToMyNumericA: Double // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope - conv = B._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: Double // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Double] implicit in scope + conv = B._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "Double") - // def convToManifestA: Double // pimpA7: no constraints - // def convToTraversableOps: Double // pimpA7: no constraints + // def convToManifestA: Double // enrichA7: no constraints + // def convToTraversableOps: Double // enrichA7: no constraints // // should not be abstract! - conv = B._conversion(A.qualifiedName + ".pimpA7") + conv = B._conversion(A.qualifiedName + ".enrichA7") assert(conv.members.length == 2) assert(conv.constraints.length == 0) assert(conv._member("convToManifestA").resultType.name == "Double") @@ -134,38 +134,38 @@ object Test extends ScaladocModelTest { val C = base._class("C") // these conversions should not affect C - assert(C._conversions(A.qualifiedName + ".pimpA3").isEmpty) - assert(C._conversions(A.qualifiedName + ".pimpA4").isEmpty) - assert(C._conversions(A.qualifiedName + ".pimpA7").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA3").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA4").isEmpty) + assert(C._conversions(A.qualifiedName + ".enrichA7").isEmpty) - // def convToPimpedA(x: Int) // pimpA0: no constraints, SHADOWED - conv = C._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: Int) // enrichA0: no constraints, SHADOWED + conv = C._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Int") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Int") - // def convToNumericA: Int // pimpA1: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: Int // enrichA1: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToNumericA").resultType.name == "Int") - // def convToIntA: Int // pimpA2: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA2") + // def convToIntA: Int // enrichA2: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA2") assert(conv.members.length == 1) assert(conv.constraints.length == 0) assert(conv._member("convToIntA").resultType.name == "Int") - // def convToPimpedA: Bar[Foo[Int]] // pimpA5: no constraints - conv = C._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[Int]] // enrichA5: no constraints + conv = C._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[Int]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[Int]]") - // def convToMyNumericA: Int // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope - conv = C._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: Int // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[Int] implicit in scope + conv = C._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "Int") @@ -175,33 +175,33 @@ object Test extends ScaladocModelTest { val D = base._class("D") // these conversions should not affect D - assert(D._conversions(A.qualifiedName + ".pimpA2").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA3").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA4").isEmpty) - assert(D._conversions(A.qualifiedName + ".pimpA7").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA2").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA3").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA4").isEmpty) + assert(D._conversions(A.qualifiedName + ".enrichA7").isEmpty) - // def convToPimpedA(x: String) // pimpA0: no constraints, SHADOWED - conv = D._conversion(A.qualifiedName + ".pimpA0") + // def convToEnrichedA(x: String) // enrichA0: no constraints, SHADOWED + conv = D._conversion(A.qualifiedName + ".enrichA0") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "String") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "String") - // def convToNumericA: String // pimpA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope - conv = D._conversion(A.qualifiedName + ".pimpA1") + // def convToNumericA: String // enrichA1: (if showAll is set) with a constraint that there is x: Numeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".enrichA1") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToNumericA").resultType.name == "String") - // def convToPimpedA: Bar[Foo[String]] // pimpA5: no constraints - conv = D._conversion(A.qualifiedName + ".pimpA5") + // def convToEnrichedA: Bar[Foo[String]] // enrichA5: no constraints + conv = D._conversion(A.qualifiedName + ".enrichA5") assert(conv.members.length == 1) assert(conv.constraints.length == 0) - assert(isShadowed(conv._member("convToPimpedA"))) - assert(conv._member("convToPimpedA").resultType.name == "Bar[Foo[String]]") + assert(isShadowed(conv._member("convToEnrichedA"))) + assert(conv._member("convToEnrichedA").resultType.name == "Bar[Foo[String]]") - // def convToMyNumericA: String // pimpA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope - conv = D._conversion(A.qualifiedName + ".pimpA6") + // def convToMyNumericA: String // enrichA6: (if showAll is set) with a constraint that there is x: MyNumeric[String] implicit in scope + conv = D._conversion(A.qualifiedName + ".enrichA6") assert(conv.members.length == 1) assert(conv.constraints.length == 1) assert(conv._member("convToMyNumericA").resultType.name == "String") |