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
It seems that a function can "accept" explicit generic parameters in this situation:
func z()->Int{1}// Non generic functionfunc z<T:FloatingPoint>()->T{1}// Generic overload of that functionlety:Int=z<Float>()// Nonsense syntax compiles (the parameter is ignored but there is no error)
It does not seem to happen when either of the overloads is commented out, catching the invalid syntax.
Expected behavior
An error message detecting the misleading syntax.
Environment
Apple Swift version 6.0-dev (LLVM 3417addab6ff197, Swift d677b7c23fd6355)
Target: arm64-apple-macosx14.0
Additional information
No response
The text was updated successfully, but these errors were encountered:
TeamPuzel
added
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
labels
May 20, 2024
Description
Swift is allowing a syntax mistake.
Reproduction
It seems that a function can "accept" explicit generic parameters in this situation:
It does not seem to happen when either of the overloads is commented out, catching the invalid syntax.
Expected behavior
An error message detecting the misleading syntax.
Environment
Additional information
No response
The text was updated successfully, but these errors were encountered: