Skip to content

Methods on IArray infer it as Array with capture checking #18909

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
reftrans opened this issue Nov 13, 2023 · 0 comments · Fixed by #18929
Closed

Methods on IArray infer it as Array with capture checking #18909

reftrans opened this issue Nov 13, 2023 · 0 comments · Fixed by #18929
Assignees
Labels
area:experimental:cc Capture checking related itype:bug

Comments

@reftrans
Copy link

Compiler version

Scala compiler version 3.4.0-RC1-bin-SNAPSHOT-git-8cb4945 -- Copyright 2002-2023, LAMP/EPFL

Minimized code

import language.experimental.captureChecking
def foo(): Unit =
  val r1: IArray[String] = ???
  val r2: String = r1.head

Output

-- [E007] Type Mismatch Error: foo.scala:4:19 ----------------------------------------------------------------------------------
4 |  val r2: String = r1.head
  |                   ^^
  |                   Found:    (r1 : IArray[String])
  |                   Required: Array[? <: String]^?
  |
  | longer explanation available when compiling with `-explain`
1 error found

Expectation

No compilater error. I presume that the opaque type is being dealiased somewhere when it should not be.

This is happening with other methods as well as head.

@reftrans reftrans added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 13, 2023
@nicolasstucki nicolasstucki added area:experimental:cc Capture checking related and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 13, 2023
Linyxus added a commit that referenced this issue Nov 15, 2023
Don't follow opaque aliases when transforming symbol info in Setup
phase.

Fixes #18909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental:cc Capture checking related itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants