argon icon indicating copy to clipboard operation
argon copied to clipboard

Strange @struct issue with default arguments

Open dkoeplin opened this issue 7 years ago • 0 comments

@struct class MyStruct(x: Int = 13, y: Int = 12)
val array = Array.tabulate(10){i => MyStruct(x = 25) }
val x = array(0).x

Gives the errors:

[error] ...: recursive value array needs type
[error]         val x = array(0).x
[error]             ^
[error] ...: failed to determine if 'x = ...' is a named argument or an assignment expression.
[error] an explicit type is required for the definition mentioned in the error message above.
[error]         val array = Array.tabulate(10){i => MyStruct(x = 25) }
[error]                                                        ^

Not yet sure why this is an issue in the virtualized case but not in normal scala syntax

dkoeplin avatar Apr 17 '17 07:04 dkoeplin