From 21a66267c661a55c8ad27248c0765276dd6f72ea Mon Sep 17 00:00:00 2001 From: Gangzheng Tong Date: Tue, 15 Jul 2025 16:39:22 -0700 Subject: Emit additional diagnostic for invalid pointer taking operations (#7663) * Emit special diagnostic for invalid pointer taking operations * Update source/slang/slang-diagnostic-defs.h Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> * Add OperatorAddressOf KnownBuiltin modifier * update error message for non-l-value assignment * update the diagnostics in the tests * Use enum based KnownBuiltinDeclName * format code (#7772) Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --------- Co-authored-by: ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> Co-authored-by: slangbot Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- tests/diagnostics/setter-method.slang.expected | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/diagnostics/setter-method.slang.expected') diff --git a/tests/diagnostics/setter-method.slang.expected b/tests/diagnostics/setter-method.slang.expected index 1c3dcad48..8df993f78 100644 --- a/tests/diagnostics/setter-method.slang.expected +++ b/tests/diagnostics/setter-method.slang.expected @@ -1,13 +1,13 @@ result code = -1 standard error = { +tests/diagnostics/setter-method.slang(16): note 30049: attempting to assign to a const variable or immutable member; use '[mutating]' attribute on the containing method to allow modification tests/diagnostics/setter-method.slang(16): error 30011: left of '=' is not an l-value. center = value; ^ -tests/diagnostics/setter-method.slang(16): note 30049: a 'this' parameter is an immutable parameter by default in Slang; apply the `[mutating]` attribute to the function declaration to opt in to a mutable `this` +tests/diagnostics/setter-method.slang(21): note 30049: attempting to assign to a const variable or immutable member; use '[mutating]' attribute on the containing method to allow modification tests/diagnostics/setter-method.slang(21): error 30011: left of '=' is not an l-value. this.radius = value; ^ -tests/diagnostics/setter-method.slang(21): note 30049: a 'this' parameter is an immutable parameter by default in Slang; apply the `[mutating]` attribute to the function declaration to opt in to a mutable `this` } standard output = { } -- cgit v1.2.3