You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that a struct like struct S{T} T::String end does not compile. Therefore I expected that struct S{T} T::T end would likewise not compile because both of them have a field with the same name as a type variable (the error message seems to imply there is a name collision causing the problem). However, the latter case was accepted by the Julia compiler.
This seems like a compiler error or an oversight in Julia semantics. Also the error message could be greatly improved to explain what the compiler thinks is wrong in the context of the surface syntax.
julia> VERSION
v"1.8.0"
julia> struct S{T} T::String end
ERROR: syntax: function argument and static parameter names must be distinct around REPL[2]:1
Stacktrace:
[1] top-level scope
@ REPL[2]:1
julia> struct S{T} T::T end
julia>
The text was updated successfully, but these errors were encountered:
I noticed that a struct like
struct S{T} T::String end
does not compile. Therefore I expected thatstruct S{T} T::T end
would likewise not compile because both of them have a field with the same name as a type variable (the error message seems to imply there is a name collision causing the problem). However, the latter case was accepted by the Julia compiler.This seems like a compiler error or an oversight in Julia semantics. Also the error message could be greatly improved to explain what the compiler thinks is wrong in the context of the surface syntax.
The text was updated successfully, but these errors were encountered: