Skip to content

Commit 7ee1378

Browse files
jamesbraindmitry.naydanov
authored and
dmitry.naydanov
committed
Moved now passing tests
#SCL-10263 fixed #SCL-7332 fixed #SCL-6384 fixed #SCL-9555 fixed #SCL-10149 fixed #SCL-10151 fixed #SCL-10264 fixed
1 parent b817007 commit 7ee1378

File tree

4 files changed

+84
-90
lines changed

4 files changed

+84
-90
lines changed

test/org/jetbrains/plugins/scala/failed/typeInference/ParameterizedTypeTest.scala

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,6 @@ import org.junit.experimental.categories.Category
1010
*/
1111
@Category(Array(classOf[PerfCycleTests]))
1212
class ParameterizedTypeTest extends ScalaLightCodeInsightFixtureTestAdapter {
13-
def testSCL6384() = {
14-
val text =
15-
"""
16-
|object Test {
17-
| class R[A](f: List[A] => A)(g: A => Any)
18-
| def f: List[String] => String = _.foldRight("")(_+_)
19-
| val r = new R(f)(_.substring(3))
20-
|}
21-
""".stripMargin
22-
checkTextHasNoErrors(text)
23-
}
24-
25-
def testSCL9555() = {
26-
val text =
27-
"""
28-
|object Test {
29-
| case class PrintedColumn[T](
30-
| name: String,
31-
| value: T => Any,
32-
| color: T => String = { _: T => "blue" })
33-
| case class Foo(a: Int, b: String)
34-
| val col: PrintedColumn[Foo] = PrintedColumn("a", _.a)
35-
|}
36-
""".stripMargin
37-
checkTextHasNoErrors(text)
38-
}
39-
4013
def testSCL7891() = {
4114
val text =
4215
"""
@@ -89,42 +62,6 @@ class ParameterizedTypeTest extends ScalaLightCodeInsightFixtureTestAdapter {
8962
checkTextHasNoErrors(text)
9063
}
9164

92-
def testSCL10149() = {
93-
val text =
94-
"""
95-
|object SCL10149{
96-
|
97-
| trait Functor[F[_]] {
98-
| def map[A, B](fa: F[A])(f: A => B): F[B]
99-
| }
100-
|
101-
| trait Applicative[F[_]] extends Functor[F] {
102-
| def apply[A, B](fab: F[A => B])(fa: F[A]): F[B] =
103-
| map2(fab, fa)((ab, a) => ab(a))
104-
|
105-
| def unit[A](a: => A): F[A]
106-
|
107-
| def map2[A, B, C](fa: F[A], fb: F[B])(f: (A, B) => C): F[C] =
108-
| apply(apply(unit(f.curried))(fa))(fb)
109-
| }
110-
|}
111-
""".stripMargin
112-
checkTextHasNoErrors(text)
113-
}
114-
115-
def testSCL10151() = {
116-
val text =
117-
"""
118-
|object Test {
119-
|
120-
| case class Failure[E](head: E, tail: Vector[E] = Vector.empty[E])
121-
|
122-
| val v1: Failure[String] = Failure("zonk")
123-
|}
124-
""".stripMargin
125-
checkTextHasNoErrors(text)
126-
}
127-
12865
def testSCL10156() = {
12966
checkTextHasNoErrors(
13067
""" import scala.language.higherKinds
@@ -204,25 +141,6 @@ class ParameterizedTypeTest extends ScalaLightCodeInsightFixtureTestAdapter {
204141
)
205142
}
206143

207-
def testSCL10264() = {
208-
checkTextHasNoErrors(
209-
"""
210-
|import scala.language.higherKinds
211-
|
212-
|trait Functor [F[_]] {
213-
| def map [A, B] (fa: F[A]) (f: A => B): F[B]
214-
|}
215-
|
216-
|trait Applicative [F[_]] extends Functor[F] {
217-
| def apply [A, B] (fab: F[A => B]) (fa: F[A]): F[B] = map2(fab, fa) (_(_))
218-
| def unit [A] (a: => A): F[A]
219-
| def map [A, B] (fa: F[A]) (f: A => B): F[B] = apply(unit(f))(fa) // <-- (fa) is highlighted, error message: "Type mismatch, expected: F[Nothing], actual: F[A]"
220-
| def map2 [A, B, C] (fa: F[A], fb: F[B]) (f: (A, B) => C): F[C]
221-
|}
222-
|""".stripMargin
223-
)
224-
}
225-
226144
//this test is intermittent!
227145
def testSCL10399(): Unit = {
228146
val fileText =

test/org/jetbrains/plugins/scala/failed/annotator/CovarianceAnnotTest.scala renamed to test/org/jetbrains/plugins/scala/lang/annotator/CovarianceAnnotTest.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
package org.jetbrains.plugins.scala.failed.annotator
1+
package org.jetbrains.plugins.scala.lang.annotator
22

3-
import org.jetbrains.plugins.scala.PerfCycleTests
43
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
5-
import org.junit.experimental.categories.Category
64

75
/**
86
* Created by Anton Yalyshev on 16/05/16.
97
*/
10-
@Category(Array(classOf[PerfCycleTests]))
118
class CovarianceAnnotTest extends ScalaLightCodeInsightFixtureTestAdapter {
129
def testSCL10263(): Unit = {
1310
checkTextHasNoErrors(

test/org/jetbrains/plugins/scala/failed/typeInference/CurriedTypeInferenceTest.scala renamed to test/org/jetbrains/plugins/scala/lang/typeInference/CurriedTypeInferenceTest.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
package org.jetbrains.plugins.scala.failed.typeInference
1+
package org.jetbrains.plugins.scala.lang.typeInference
22

3-
import org.jetbrains.plugins.scala.PerfCycleTests
43
import org.jetbrains.plugins.scala.base.ScalaLightCodeInsightFixtureTestAdapter
5-
import org.junit.experimental.categories.Category
64

75
/**
86
* @author Roman.Shein
97
* @since 01.04.2016.
108
*/
11-
@Category(Array(classOf[PerfCycleTests]))
129
class CurriedTypeInferenceTest extends ScalaLightCodeInsightFixtureTestAdapter {
1310
def testSCL7332() = checkTextHasNoErrors(
1411
"""

test/org/jetbrains/plugins/scala/lang/typeInference/ParameterizedTypeTest.scala

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,86 @@ class ParameterizedTypeTest extends ScalaLightCodeInsightFixtureTestAdapter {
5555
|}""".stripMargin
5656
)
5757
}
58+
59+
def testSCL6384() = {
60+
val text =
61+
"""
62+
|object Test {
63+
| class R[A](f: List[A] => A)(g: A => Any)
64+
| def f: List[String] => String = _.foldRight("")(_+_)
65+
| val r = new R(f)(_.substring(3))
66+
|}
67+
""".stripMargin
68+
checkTextHasNoErrors(text)
69+
}
70+
71+
def testSCL9555() = {
72+
val text =
73+
"""
74+
|object Test {
75+
| case class PrintedColumn[T](
76+
| name: String,
77+
| value: T => Any,
78+
| color: T => String = { _: T => "blue" })
79+
| case class Foo(a: Int, b: String)
80+
| val col: PrintedColumn[Foo] = PrintedColumn("a", _.a)
81+
|}
82+
""".stripMargin
83+
checkTextHasNoErrors(text)
84+
}
85+
86+
def testSCL10149() = {
87+
val text =
88+
"""
89+
|object SCL10149{
90+
|
91+
| trait Functor[F[_]] {
92+
| def map[A, B](fa: F[A])(f: A => B): F[B]
93+
| }
94+
|
95+
| trait Applicative[F[_]] extends Functor[F] {
96+
| def apply[A, B](fab: F[A => B])(fa: F[A]): F[B] =
97+
| map2(fab, fa)((ab, a) => ab(a))
98+
|
99+
| def unit[A](a: => A): F[A]
100+
|
101+
| def map2[A, B, C](fa: F[A], fb: F[B])(f: (A, B) => C): F[C] =
102+
| apply(apply(unit(f.curried))(fa))(fb)
103+
| }
104+
|}
105+
""".stripMargin
106+
checkTextHasNoErrors(text)
107+
}
108+
109+
def testSCL10151() = {
110+
val text =
111+
"""
112+
|object Test {
113+
|
114+
| case class Failure[E](head: E, tail: Vector[E] = Vector.empty[E])
115+
|
116+
| val v1: Failure[String] = Failure("zonk")
117+
|}
118+
""".stripMargin
119+
checkTextHasNoErrors(text)
120+
}
121+
122+
def testSCL10264() = {
123+
checkTextHasNoErrors(
124+
"""
125+
|import scala.language.higherKinds
126+
|
127+
|trait Functor [F[_]] {
128+
| def map [A, B] (fa: F[A]) (f: A => B): F[B]
129+
|}
130+
|
131+
|trait Applicative [F[_]] extends Functor[F] {
132+
| def apply [A, B] (fab: F[A => B]) (fa: F[A]): F[B] = map2(fab, fa) (_(_))
133+
| def unit [A] (a: => A): F[A]
134+
| def map [A, B] (fa: F[A]) (f: A => B): F[B] = apply(unit(f))(fa) // <-- (fa) is highlighted, error message: "Type mismatch, expected: F[Nothing], actual: F[A]"
135+
| def map2 [A, B, C] (fa: F[A], fb: F[B]) (f: (A, B) => C): F[C]
136+
|}
137+
|""".stripMargin
138+
)
139+
}
58140
}

0 commit comments

Comments
 (0)