Skip to content

Bug with scala.js return type check and intersection types #9892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
oyvindberg opened this issue Sep 26, 2020 · 0 comments · Fixed by #9953
Closed

Bug with scala.js return type check and intersection types #9892

oyvindberg opened this issue Sep 26, 2020 · 0 comments · Fixed by #9953

Comments

@oyvindberg
Copy link

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 and U 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 vals
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants