-
Notifications
You must be signed in to change notification settings - Fork 1.1k
given
declarations with &
do not compile as expected
#22677
New issue
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
Comments
This doesn't seem to be an issue in Minimized codetrait A:
def a: Unit
trait B:
def b: Unit
class ABImpl extends A, B:
def a: Unit = println("a")
def b: Unit = println("b")
// Compiles when a type alias is used
type AB = A & B
given namedGivenWithTypeAlias: AB = ABImpl()
given AB = ABImpl()
// Compiles with parentheses
object A:
given namedGivenWithParentheses: (A & B) = ABImpl()
object B:
given (A & B) = ABImpl()
// Does not compile when & is used inline
object C:
given namedGivenInline: A & B = ABImpl()
object D:
given A & B = ABImpl()
(modification of the original snippet was required as |
given
declarations with &
do no compile as expectedgiven
declarations with &
do not compile as expected
@WojciechMazur @tgodzik |
I'd say that's a |
Alright. I'm closing it for now then. |
Compiler version
3.3.5
Minimized code
Output
Expectation
given namedGivenInline: A & B = ABImpl()
andgiven A & B = ABImpl()
should compile as valid given declarations.The text was updated successfully, but these errors were encountered: