File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
macros/src/test/scala/net/exoego/scalajs/types/util Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -32,9 +32,10 @@ class FactoryTest extends AnyFlatSpec with Matchers {
32
32
""" @Factory trait X extends scala.scalajs.js.Object {}""" should compile
33
33
}
34
34
35
- it should " not a compile when applied to a Scala-native trait not ext " in {
35
+ it should " not compile when applied to a Scala-native trait not extending js.Object " in {
36
36
""" @Factory trait X""" shouldNot compile
37
37
""" @Factory trait X {}""" shouldNot compile
38
+ """ @Factory trait X extends Seq[Int]""" shouldNot compile
38
39
}
39
40
40
41
" factory method " should " have defined parameter" in {
@@ -73,6 +74,16 @@ class FactoryTest extends AnyFlatSpec with Matchers {
73
74
""" val a: Nested = Nested(name = "yay")
74
75
| """ .stripMargin should compile
75
76
}
77
+
78
+ it should " have inherited members as parameter" in {
79
+ """ val a: Inherited = Inherited(own = 42)
80
+ | """ .stripMargin shouldNot compile
81
+
82
+ """ val a: Inherited = Inherited(name= "yay", own = 42)
83
+ | val x: String = a.name
84
+ | val y: Int = a.own
85
+ | """ .stripMargin should compile
86
+ }
76
87
}
77
88
78
89
@ Factory
@@ -111,3 +122,8 @@ trait Nested extends js.Object {
111
122
object Nested {
112
123
type Z = String
113
124
}
125
+
126
+ @ Factory
127
+ trait Inherited extends TargetScalaNative {
128
+ var own : Int
129
+ }
You can’t perform that action at this time.
0 commit comments