title: Unresolved reference at compile but available by Intellisense
body: <p>I'm working on an audio processing library for Flutter, and I'm running into an issue with one of my native Kotlin classes. In the code sample below, the compiler is complaining that the call to <code>copyInto</code> on the <code>samples</code> array is an unresolved reference. As far as I can tell, I've made sure that it is an <code>IntArray</code>, and Intellisense in Android Studio even brings up <code>copyInto</code> as an option when I type "samples.".</p>
  
  <p>Here is my class code:</p>
  
  <pre><code>package com.----.audio_channels
  
  import kotlin.math.abs
  import kotlin.math.min
  
  abstract class AudioTrackBuffer constructor(val loop: Boolean) {
      var position: Int = 0
  
      abstract fun getSamples(sampleCount: Int): IntArray
      abstract fun isComplete(): Boolean
      abstract fun dispose()
  }
  
  class RawAudioBuffer constructor(private val samples: IntArray, loop: Boolean, delay: Int): AudioTrackBuffer(loop) {
  
      init {
          position = -delay
      }
  
      override fun getSamples(sampleCount: Int): IntArray {
          val slice: IntArray
  
          if (position &lt; 0) {
              slice = IntArray(sampleCount) { 0 }
  
              if (position + sampleCount &lt; 0) {
                  position += sampleCount
                  return slice
              }
  
              val offset = abs(position)
              samples.copyInto(slice, offset, 0, min(sampleCount - offset, samples.size)) // Error
          } else {
              slice = samples.copyOfRange(position, min(position + sampleCount, samples.size))
              position += slice.size
          }
  
          return slice
      }
  
      override fun isComplete(): Boolean {
          return position &gt;= samples.size
      }
  
      override fun dispose() {}
  }
  </code></pre>
  
  <p>And here is the compile error:</p>
  
  <pre><code>Launching lib\main.dart on SM N960U in debug mode...
  Initializing gradle...
  Resolving dependencies...
  Running Gradle task 'assembleDebug'...
  e: E:\flutter\workspace\audio_channels\android\src\main\kotlin\com\----\audio_channels\AudioTrackBuffer.kt: (33, 21): Unresolved reference: copyInto
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':audio_channels:compileDebugKotlin'.
  &gt; Compilation error. See log for more details
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 1s
  Finished with error: Gradle task assembleDebug failed with exit code 1
  </code></pre>