Skip to content

Unmapped type from capture checking with levels #18554

Open
@EugeneFlesselle

Description

@EugeneFlesselle

Adding MapView to the capture checking standard library tests (here) works fine before using levels for capture escape checking.

However, on the main branch after #18463, we get the following error:

-- [E007] Type Mismatch Error: tests/pos-special/stdlib/collection/MapView.scala:45:99 ---------------------------------
45 |  override def filterKeys(p: K => Boolean): MapView[K, V]^{this, p} = new MapView.FilterKeys(this, p)
   |                                                                                                   ^
   |                                                                                    Found:    K ->{p} Boolean
   |                                                                                    Required: box K^? => Boolean
   |--------------------------------------------------------------------------------------------------------------------
   | Explanation (enabled by `-explain`)
   |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   |
   | Tree: p
   | I tried to show that
   |   K ->{p} Boolean
   | conforms to
   |   box K^? => Boolean
   | but the comparison trace ended with `false`:
   |
   |   ==> K ->{p} Boolean  <:  box K^? => Boolean
   |     ==> subcaptures {p} <:< {cap} 
   |     <== subcaptures {p} <:< {cap}  = {cap}
   |     ==> subcaptures {p} <:< {cap} 
   |     <== subcaptures {p} <:< {cap}  = {cap}
   |   <== K ->{p} Boolean  <:  box K^? => Boolean = false
   |
   | The tests were made under the empty constraint
    --------------------------------------------------------------------------------------------------------------------

I still expected it to conform, but I am not familiar with the new changes using levels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions