title: Strange behavior with swift compiler
body: <p>I have the following function in swift:</p>
  
  <pre><code>func f() -&gt; Int
  {
      let a = String("a")
      let b = a.unicodeScalars
      println(b[b.startIndex].value)
  
     //return b[b.startIndex].value
     return 1
  }
  </code></pre>
  
  <p>If I uncomment the first return statement and comment the second one, then I get the compiler error:</p>
  
  <blockquote>
    <p>Could not find the member 'value'</p>
  </blockquote>
  
  <p>Why this happens even when I have access to this member in the println function call?</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>In order to make the question more clear, consider the following code:</p>
  
  <pre><code>struct point {
      var x: UInt32
      var y: UInt32
  
      init (x: UInt32, y: UInt32) {
          self.x = x
          self.y = y
      }
  }
  
  func f () -&gt; Int {
      var arr = [point(x: 0, y: 0)]
      return arr[0].x
  }
  </code></pre>
  
  <p>In this case, the compiler error is:</p>
  
  <blockquote>
    <p>UInt32 is not convertible to Int</p>
  </blockquote>
  
  <p>My question is: Why the compiler errors are different even when the problem is the same in both cases?</p>