We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
3.3.1
//> using scala "3.3.1" trait Food[+A] trait Animal object Animal { extension (animal: Animal) def consume[A](weights: Food[A]): A = ??? } val animal: Animal = ??? val choices: List[Food[Int]] = ??? val result0: List[Any] = choices.map(animal.consume) // compiles // val result1: List[Int] = choices.map(animal.consume) // does not compile val result2: List[Int] = choices.map(food => animal.consume(food)) val result3: List[Int] = choices.map(animal.consume(_))
Found: Food[Any] => Any Required: Food[Int] => Int
result1 either compiles or raises a clear error message that such usage is forbidden.
result1
The text was updated successfully, but these errors were encountered:
val result4: List[Int] = choices.map(food => Animal.consume(animal)(food)) val result5: List[Int] = choices.map(Animal.consume(animal))
for completeness
Sorry, something went wrong.
Add regression tests
f1e3714
Closes scala#19749 Closes scala#18558 Closes scala#16208
No branches or pull requests
Compiler version
3.3.1
Minimized code
Output
Expectation
result1
either compiles or raises a clear error message that such usage is forbidden.The text was updated successfully, but these errors were encountered: