Skip to content

Conversation

@bracevac
Copy link
Contributor

Fixes #21868

@bracevac
Copy link
Contributor Author

@noti0na1 I think it'd be good to merge this into #21875

@noti0na1
Copy link
Member

Sure! I will take a look.

@bracevac
Copy link
Contributor Author

bracevac commented Nov 19, 2024

The test case for this is tied to the paths to "capture set type members" that your PR fixes:

import language.experimental.captureChecking
import caps._

trait Abstract:
    type C <: CapSet
    def boom(): Unit^{this.C^}

class Concrete extends Abstract:
    type C = Nothing
    def boom() = () 

now yields

-- Error: local/i21868.scala:10:14 ---------------------------------------------
10 |    def boom() = () 
   |              ^
   |              Illegal capture reference: Nothing
Illegal capture reference: Nothing
-- Error: local/i21868.scala:6:22 ----------------------------------------------
6 |    def boom(): Unit^{this.C^}
  |                      ^^^^^^^
  |          Abstract.this.C cannot be tracked since its capture set is empty

And I think the second one shouldn't be reported.

Edit: removed an unnecessary class definition

@noti0na1
Copy link
Member

I think the second error is valid, because the capture set of the upper bound of type C <: CapSet is empty.

@noti0na1
Copy link
Member

It seems the function is called twice on the same type at different places, so the error is reported twice.

@bracevac
Copy link
Contributor Author

Merged with #21875

@bracevac bracevac closed this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instantiating abstract types bounded by CapSet with Nothing crashes the capture checker

2 participants