title: has kotlin compiler a bug with plus operator?
body: <p>I like kotlin's <code>+=</code> syntax for lists.
  Its a concise and intuitive notation.</p>
  <p>But recently I discovered an edge case, where I suspect, the compiler is buggy.</p>
  <p><code>java.nio.file.Path</code> is defined recursively <code>public interface Path extends Iterable&lt;Path&gt;, ...</code>
  And that seems to cause problems for <code>Iterable</code>'s <code>plus operator</code> in <code>kotlin-stdlib</code>.</p>
  <pre><code>private val abc = Path.of(&quot;/tmp/abc.txt&quot;)
  private val def = Path.of(&quot;/tmp/def.txt&quot;)
  
  @Test
  fun `plus operator List Path`() {
      var list = emptyList&lt;Path&gt;()
      list += listOf(abc)
      list += def  // (*) should not compile
  
      list.asClue {
          // oops. red bar.
          it shouldBe listOf(abc, def)
      }
  }
  </code></pre>
  <p>The test fails with:</p>
  <pre><code>Elements differ at index 1: [\tmp\abc.txt, tmp, def.txt]
  </code></pre>
  <p>In my opinion the line marked with <code>(*)</code> shouldn't even compile, since it is not clear which of the following overloads is intended</p>
  <ul>
  <li><a href="https://github.com/JetBrains/kotlin/blob/1b49105c78c566ec42b422cbd46782b47a0d9f40/libraries/stdlib/common/src/generated/_Collections.kt#L3062" rel="nofollow noreferrer">operator fun  Iterable.plus(element: T)</a></li>
  <li><a href="https://github.com/JetBrains/kotlin/blob/1b49105c78c566ec42b422cbd46782b47a0d9f40/libraries/stdlib/common/src/generated/_Collections.kt#L3104" rel="nofollow noreferrer">operator fun  Iterable.plus(elements: Iterable)</a></li>
  </ul>
  <p>Notice that for <code>plusAssign operator</code> on <code>MutableList</code> compilation is rightly rejected.</p>
  <pre><code>@Test
  fun `plusAssign operator MutableList Path`() {
      val list = mutableListOf&lt;Path&gt;()
      list += listOf(abc)
      // does not compile, which is good
      // list += def // (**)
  
      list shouldBe listOf(abc)
  }
  </code></pre>
  <p>The line marked with <code>(**)</code> is ambiguous for</p>
  <ul>
  <li><a href="https://github.com/JetBrains/kotlin/blob/1b49105c78c566ec42b422cbd46782b47a0d9f40/libraries/stdlib/src/kotlin/collections/MutableCollections.kt#L51" rel="nofollow noreferrer">operator fun  MutableCollection.plusAssign(element: T)</a></li>
  <li><a href="https://github.com/JetBrains/kotlin/blob/1b49105c78c566ec42b422cbd46782b47a0d9f40/libraries/stdlib/src/kotlin/collections/MutableCollections.kt#L59" rel="nofollow noreferrer">operator fun  MutableCollection.plusAssign(elements: Iterable)</a></li>
  </ul>