scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.89k stars 1.06k forks source link

Lint when a parameter should be marked as `tracked`, but couldn't be inferred #21987

Open KacperFKorban opened 5 days ago

KacperFKorban commented 5 days ago

Description

The compiler should give a lint when a parameter should be marked as tracked, but the compiler couldn't infer it correctly.

Example

For the following example:

class C[T](tracked val t: T)

class D[T](val t: T) extends C[T](t) // warn `t` should be `tracked`

The compiler should warn, that t should most likely be marked as tracked, since it is used as a tracked parameter in C.

Details

This should be enabled under a linting flag that only works under experimental.modularity