title: scala scoping brings in types not shown in import
body: <p>I read an article concerning that scala's type inference might have done too
  much:</p>
  
  <p>Given this piece of code:</p>
  
  <pre><code>package A1 {
    case class Foo(a: Int)
  
    package object A2 {
      def bar() = Foo(1)
    }
  }
  
  --
  import A1.A2._
  object Main extends App {
    val a: Foo = bar()  // error: not found type Foo
  }
  </code></pre>
  
  <p>It won't compile as <code>Main</code> can't see <code>Foo</code> unless we also <code>import A1.Foo</code>.</p>
  
  <p>Whereas if the type annotation is taken away, then it fine:</p>
  
  <pre><code>import A1.A2._
  object Main extends App {
    val a = bar()
  }
  </code></pre>
  
  <p>The author thinks this comparing to java, where we have to explicitly import whatever types we're using, would reduce readability as imports no long have complete information about the set of types we're using.</p>
  
  <p>I think what he wants is that the types being used, explicitly or implicitly, need to be imported to make it clear what the code depends on and perhaps to assist some static analysis tools.</p>
  
  <p>For this problem I wonder what you think about it.</p>
  
  <p>EDIT:
  As @flavian pointing out, this has little to do with type inference, more of how scoping works.</p>
  
  <p>EDIT2:
  I have a second thought on this. Maybe this question is not important if an IDE can automatically add imports(even for those used implicitly) if the developer wants to.</p>
  
  <p>--</p>