Closed
Description
Minimized code
import scala.scalajs.js
@js.native
trait ObjectConstructor {
def assign[T, U](target: T, source: U): T with U = js.native
}
Output
[error] -- Error: /home/olvind/.cache/scalablytyped/ScalablyTyped/s/std/src/main/scala/typings/std/ObjectConstructor.scala:30:6
[error] 30 | def assign[T, U](target: T, source: U): T with U = js.native
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error] |The type of assign must be explicitly specified because it is JS native.
Expectation
Should compile.
Notes:
- Works in scala 2
- Tested with 0.28.0-bin-20200925-f4528ce-NIGHTLY
- annotated return type of
T & U
compiles T
andU
could be concrete types and still trigger the error. I have several examples with concrete types, this was just the smallest- I also saw this for
val
s - It might not actually be relevant given the above, but I thought I should mention this was just fixed, Bad interaction between package objects, Nothing, type parameters #9717