This code fails: ``` void main() { static void func(T)(T a, T b) { } 2.func!int(2); // Error: no property `func` for type `int` } ``` whereas this code compiles fine: ``` static void func(T)(T a, T b) { } void main() { 2.func!int(2); } ``` I haven't found anything in the spec about this case, but I don't see why ufcs would not be considered in the former case.
This is intentionally disallowed, though it is sometimes requested as an improvement. https://dlang.org/spec/function.html#pseudo-member > Functions declared in a local scope are not found when searching for a matching UFCS function.
Cool, closing as invalid.
Some code relies on the current behavior by the way: http://dpldocs.info/this-week-in-d/Blog.Posted_2022_01_31.html#tip-of-the-week