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
In Golang the channel push statement <- ch is valid. In V is mandatory to have _ := <-ch but unexpectedly this also is accepted in V:
_ :=
<-
ch
This assignation valid after several rows and spaces creates problems with the line the compiler indicates as error.
Use Case
Next program has a V syntax error in line 20 <-ch and the compiler notifies the error far before in line 12 thinking there is the receiver of invalid type:
Describe the feature
In Golang the channel push statement
<- ch
is valid. In V is mandatory to have_ := <-ch
but unexpectedly this also is accepted in V:This assignation valid after several rows and spaces creates problems with the line the compiler indicates as error.
Use Case
Next program has a V syntax error in line 20
<-ch
and the compiler notifies the error far before in line 12 thinking there is the receiver of invalid type:Produces
It takes time to realize where the problem really is.
Proposed Solution
Improve the error line like this, showing the line of the
<-
operator.Then the fix is done in line 20:
Other features to consider:
Accept as valid (as in Golang)
Reject as invalid having the receiver and producer in different lines:
Other Information
Acknowledgements
Version used
V 0.4.9 991ec1f
Environment details (OS name and version, etc.)
https://play.vlang.io/p/e14013a25d
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: