Safe-DS / DSL

Statically checked Data Science programs.
https://dsl.safeds.com
MIT License
11 stars 0 forks source link

New constraint to check type parameter of constaining class #1139

Open lars-reimann opened 2 months ago

lars-reimann commented 2 months ago

Is your feature request related to a problem?

We need a way to hide methods of a class based on the substitution for some type parameter. This can be used to hide the predict method of models that are not fitted

Desired solution

Add a new constraint:

class Model<State = TrainingState.Unfitted> {
    fun predict() where {
        State sub TrainingState.Fitted
    }
}

Possible alternatives (optional)

No response

Screenshots (optional)

No response

Additional Context (optional)

No response