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
zapateo
changed the title
compiler/checker: 'declared and not used' error not reported by type switch
compiler/checker: 'declared and not used' error not reported in type switch statements
Nov 25, 2019
This commit fixes some unreported errors in the type switch. For the
following example, the type checker does not report the error
'x declared but not used'
switch x := interface{}(0).(type) { case int: }
For the following example, the type checker does not report the error
'x redeclared in this block'
switch x := interface{}(0).(type) { case int: var x = 5; _ = x }
This commit fixes these issues and reports the errors in the same
position reported by gc.
Fixes#474
This commit fixes some unreported errors in the type switch. For the
following example, the type checker does not report the error
'x declared but not used'
switch x := interface{}(0).(type) { case int: }
For the following example, the type checker does not report the error
'x redeclared in this block'
switch x := interface{}(0).(type) { case int: var x = 5; _ = x }
This commit fixes these issues and reports the errors in the same
position reported by gc.
Fixes#474
should report the error
v declared and not used
but Scriggo executes without any problem.Note that this behaviour meets the Golang specs but it's not coherent with gc.
From https://golang.org/ref/spec#Variable_declarations:
This bug was intentionally introduced when #230 has been closed.
The text was updated successfully, but these errors were encountered: