Skip to content

scala.language.dynamics import is "shadowed" by any other import #3736

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
propensive opened this issue Jan 2, 2018 · 0 comments
Closed

scala.language.dynamics import is "shadowed" by any other import #3736

propensive opened this issue Jan 2, 2018 · 0 comments

Comments

@propensive
Copy link
Contributor

The scala.language.dynamics implicit for enabling use of the Dynamic trait appears to be strangely "shadowed" by any subsequent import.

This does not compile,

import scala.language.dynamics
import scala.List
class Foo() extends Dynamic

with

dotc test.scala

whereas omitting

import scala.List

will allow it to compile, as will reordering the imports like so,

import scala.List
import scala.language.dynamics
class Foo() extends Dynamic

Compiler version:

Dotty compiler version 0.5.0-RC1 -- Copyright 2002-2017, LAMP/EPFL

Compiler output:

-- Error: test.scala:3:6 -------------------------------------------------------
3 |class Foo() extends Dynamic
  |^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |extension of type scala.Dynamic needs to be enabled
  |by making the implicit value scala.language.dynamics visible.
  |This can be achieved by adding the import clause 'import scala.language.dynamics'
  |or by setting the compiler option -language:dynamics.
  |See the Scala docs for value scala.language.dynamics for a discussion
  |why the feature needs to be explicitly enabled.
one error found
@nicolasstucki nicolasstucki self-assigned this Jan 3, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 3, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jan 4, 2018
@smarter smarter closed this as completed in ad96b03 Jan 4, 2018
smarter added a commit that referenced this issue Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants