dmd/compiler/test/fail_compilation/aa_init.d
Nick Treleaven abe5f13007
Fix Issue 15752 - Better Error Message for Assigning Incorrect AA Empty Value (#15599)
Also show location of value with missing index in initializer.
2023-09-12 11:55:20 +03:00

16 lines
431 B
D

/*
REQUIRED_ARGS: -vcolumns
TEST_OUTPUT:
---
fail_compilation/aa_init.d(13,18): Error: invalid associative array initializer `[]`, use `null` instead
fail_compilation/aa_init.d(14,24): Error: missing key for value `4` in initializer
fail_compilation/aa_init.d(15,9): Error: cannot implicitly convert expression `[]` of type `void[]` to `int[int]`
---
*/
void main()
{
int[int] a = [];
int[int] b = [2:3, 4];
a = [];
}