Bug? Inline function locals/params shadow namespace members - Palette.text resolves to local text
-
Inside an inline function, a local or parameter whose name matches a namespace member hijacks even the fully-qualified access (cases 2 and 3 below print the local value instead of 123).
Cost a lot of time and tokens today, since there's no error.

Am I doing something wrong here around namespaces, or is this a bug?
HiseSnippet 1059.3ocsVstaZbDEdVr2nx11nFo9.Lh+TnwwFvXLIn1Fa.2fZrMJ3Fk+kLr6P1Id1YVsyPrQQQpOD8IrOA8Mn8L6rvB1Degpt+.wbt9ctLmyLHQ5SUJYBxw6rowTjy23NbpPG1IjvDn9cQNOz8XhRSSvVRGNMlnTz.jiyF+pgfSwMQoe+8ubHgSD9zbRHzqkLe5KYQLcN03m+aLN+HR.8LVzBR23488khNRtbBfmMbqhhI9mSdO8DhQrBtnWPTgHmezsUypMCnjliqG7TexdiaTuVq8GETqQvnVT+Qs1eu8CZ0jzD47fdALsLYnlnoJvnGJClNLTdgv5fWyTrQbp4PMzPvyVxnNgLdvfYIGEB4r4f7T0F1T026dLKfMmddJ66RYfy0XwjlSgaBR0tGPxYAHsoEROxcneBKVmywfmu1su.pfiIPsYQnXkEU3gttcjfDB81QjyoGk.GlqQ4lUqtEF9oRaOuc1A+BlhZU7YXlfyDzmLdhvWyjBLW5S3pchIIjHEVERBjWfEP0SAURJNhFMhlnvGz4UmNbH9.b2SOaaiMGX5v.qokXh.Sih0SwwIxOP80+fxP2BErTzWvzfLAX+Pp+4XcHEC8LJImlZndWFC5PCdFlv43wPiD1fPEXMvJ3Z02EW1nSNlLZqqrsmWNoADNUqodepnWwT13ORRvZ5kZ7OYLQauOmlIpUAefPJlFImnvyyA+0e7mFipSjbubsIfff1yjpbEuO4UbAyVJM0AhxmPK01CCecxhqTnWtD3MRt2D34eO4mwkvOdFp2N0fOFHgwkoYoCCpqTBJfetsmwHkypk0qf6mVByg+ELcHlXqjooo.76Ll7cdrUH4KMhYCFqF24vAbs0fak4KqWtmgi2BfvFR69ECoztRpYR1sFVCLhV1v2DZq.86li9Ty9e.8VeUxZFaBKKTZ7EBEgLMBftLNGFVbkdtqFOBYmYxUdVzXy3R3lPxcpX0HObAmm626Y3tDTZOGgRwIRM8zrKEfb3qxZ73UxqiMj4zjUx1rcI4lTrrXhYfzV1PetfvzzkGQ+f61HZe6LzEDzNu5zXZ14ij7.ynWy+u9.cT1PX3e+d+tDMwLiOiFHWLMQyLvwoK8ivVU6D+htcopy0xXD55qCfEQxfIbhd4sSl81YLf7wRqDLi8EJld5h60uGqrpdiqrtqP7QtCXZ+vUiwBq.iPl5+CLlsn+ac6MdLzLmCvMcO5Mq6V8aw8uRNQyDu+XhNgcIxw8jIQCg8X9Tv6BAkCF20ofoawdtp4rICLjJBRO7OvWFyZlyNYLqMiIJh3mHea1DCySI9pTJ.lDoO0pH7lO3LtFJ8lwh44H3kMu02eYScMEqutJt65pXi0Uw8VWEattJt+5pXqaWQyCOOXhVFYu1fPGOnW5nDGmdBBzAl1sh9W.hI72f// Inline-function locals/params shadow namespace members ACROSS A DOT. // Expected: all four lines print 123 (the namespace const). namespace Palette { const var text = 123; } // 1. Anonymous function — control const var anon = function() { var text = "local value"; Console.print("1. anonymous function -> " + Palette.text ); }; anon(); // 2. Inline function with a local named `text` inline function withLocal() { local text = "local value"; Console.print("2. inline, local `text` -> " + Palette.text); } withLocal(); // 3. Inline function with a parameter named `text` inline function withParam(text) { Console.print("3. inline, param `text` -> " + Palette.text); } withParam("param value"); // 4. Inline function with no name collision — control inline function noCollision() { local other = "local value"; Console.print("4. inline, no collision -> " + Palette.text); } noCollision();expected
123for all four functions but get:Interface: 1. anonymous function -> 123 Interface: 2. inline, local `text` -> local value Interface: 3. inline, param `text` -> param value Interface: 4. inline, no collision -> 123 -
@dannytaurus Yeah looks a bug to me, I would expect 123 to be printed in all cases.
-
-
-
@dannytaurus Nice one

-
When the time comes for @Christoph-Hart to merge/manage the current pile of PRs, we'll not see him until his beard touches the ground... Let's hope he has a strong pilosity! (and a good stock of "Hopfenkaltschale"
)
-
@ustk Yeah, definitely be good to get the nod from Christoph on a lot of these PRs.
Claude does a great job of making and testing bug fixes, but only Christoph really knows where the dragons are hiding in the code!
