diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-06-30 15:25:59 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-30 12:25:59 -0700 |
| commit | c5b0708ead5de2d90ef14f20b5b8e3ed4f576373 (patch) | |
| tree | 0e7691cda679b5f937d7ed73eba021ad9170245c /tests/diagnostics | |
| parent | a3ad4dd77bba6c87abad4f76b72055c9fed94bad (diff) | |
Fix for operator assignment issue (#2951)
* WIP handling LValue coercion via LValueImplicitCast
* Need to have the ptr type for the cast.
* Casting conversion working on C++.
* Make the LValue casts record if in or in/out as we can produce better code if we know the difference.
* WIP LValueCast pass
* Fix tests so we don't fail because downstream compilers detect use of uninitialized variable.
* Do conversions through through tmp for l-value scenarios that can't work other ways.
* Fix a typo.
* Change diagnostic implicit-cast-lvalue for a type that still exhibits the issue.
* Add matrix test.
* Added a bit more clarity around LValue casting choices.
* Small comment improvements.
Improvements based on comments on PR.
* Use findOuterGeneric.
Diffstat (limited to 'tests/diagnostics')
| -rw-r--r-- | tests/diagnostics/implicit-cast-lvalue.slang | 9 | ||||
| -rw-r--r-- | tests/diagnostics/implicit-cast-lvalue.slang.expected | 7 |
2 files changed, 12 insertions, 4 deletions
diff --git a/tests/diagnostics/implicit-cast-lvalue.slang b/tests/diagnostics/implicit-cast-lvalue.slang index 79b619443..daf196378 100644 --- a/tests/diagnostics/implicit-cast-lvalue.slang +++ b/tests/diagnostics/implicit-cast-lvalue.slang @@ -1,15 +1,20 @@ //DIAGNOSTIC_TEST:SIMPLE: + +// Generally speaking: // Passing an argument for an `out` parameter such // that implicit conversion would be required in // both directions. +// +// But we do have special case code to handle uint/int of the same type and scalar/vector/matrix forms. +// So for this to fail we need to use floats or something else -void a(out uint x) +void a(out float x) { x = 0; } -void b(int y) +void b(double y) { a(y); } diff --git a/tests/diagnostics/implicit-cast-lvalue.slang.expected b/tests/diagnostics/implicit-cast-lvalue.slang.expected index 3fdd846a5..920ad17c2 100644 --- a/tests/diagnostics/implicit-cast-lvalue.slang.expected +++ b/tests/diagnostics/implicit-cast-lvalue.slang.expected @@ -1,9 +1,12 @@ result code = -1 standard error = { -tests/diagnostics/implicit-cast-lvalue.slang(14): error 30047: argument passed to parameter '0' must be l-value. +tests/diagnostics/implicit-cast-lvalue.slang(19): warning 30081: implicit conversion from 'double' to 'float' is not recommended a(y); ^ -tests/diagnostics/implicit-cast-lvalue.slang(14): note 30048: argument was implicitly cast from 'int' to 'uint', and Slang does not support using an implicit cast as an l-value +tests/diagnostics/implicit-cast-lvalue.slang(19): error 30047: argument passed to parameter '0' must be l-value. + a(y); + ^ +tests/diagnostics/implicit-cast-lvalue.slang(19): note 30048: argument was implicitly cast from 'double' to 'float', and Slang does not support using an implicit cast as an l-value } standard output = { } |
