File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
analyzer/src/test/scala/com/avsystem/commons/analyzer Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,22 @@ final class ExplicitGenericsTest extends AnyFunSuite with AnalyzerTest {
43
43
}
44
44
45
45
test(" inferred in constructor should be rejected" ) {
46
- assertErrors(1 ,
46
+ assertErrors(2 ,
47
47
scala """
48
48
|import com.avsystem.commons.analyzer.TestUtils
49
49
|
50
50
|val x = new TestUtils.GenericClass()
51
+ |val y = new TestUtils.GenericCaseClass(123)
52
+ | """ .stripMargin)
53
+ }
54
+
55
+
56
+ test(" inferred in apply when constructor marked should be rejected" ) {
57
+ assertErrors(1 ,
58
+ scala """
59
+ |import com.avsystem.commons.analyzer.TestUtils
60
+ |
61
+ |val x = TestUtils.GenericCaseClass(123)
51
62
| """ .stripMargin)
52
63
}
53
64
@@ -59,4 +70,18 @@ final class ExplicitGenericsTest extends AnyFunSuite with AnalyzerTest {
59
70
|val x = new TestUtils.GenericClass[Int]()
60
71
| """ .stripMargin)
61
72
}
73
+
74
+ test(" not marked should not be rejected" ) {
75
+ assertNoErrors(
76
+ scala """
77
+ |def method[T](e: T) = e
78
+ |class NotMarkedGenericClass[T]
79
+ |final case class NotMarkedGenericCaseClass[T](arg: T)
80
+ |
81
+ |val w = method(123)
82
+ |val x = new NotMarkedGenericClass()
83
+ |val y = NotMarkedGenericCaseClass(123)
84
+ |val z = new NotMarkedGenericClass()
85
+ | """ .stripMargin)
86
+ }
62
87
}
Original file line number Diff line number Diff line change @@ -32,5 +32,6 @@ object TestUtils {
32
32
@ explicitGenerics
33
33
class GenericClass [T ]
34
34
35
+ @ explicitGenerics
35
36
case class GenericCaseClass [T ](arg : T )
36
37
}
You can’t perform that action at this time.
0 commit comments