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
The following code compiles and runs successfully in Gno, but it should not. Instead, it should return a compilation error indicating that a type assertion is required when converting an interface{} to a concrete type.
package main
funcmain() {
vartinterface{}
t=2varg=int(t)
println(g)
}
Expected Behavior
The code should fail to compile and return an error similar to:
cannot convert t (variable of type interface{}) to type int: need type assertion
This is the expected behavior in Go, as direct type conversion from an interface{} to a concrete type without a type assertion is not allowed.
Actual Behavior
In Gno, the code compiles and executes successfully, producing the output:
2
The text was updated successfully, but these errors were encountered:
Description
The following code compiles and runs successfully in Gno, but it should not. Instead, it should return a compilation error indicating that a type assertion is required when converting an
interface{}
to a concrete type.Expected Behavior
The code should fail to compile and return an error similar to:
This is the expected behavior in Go, as direct type conversion from an
interface{}
to a concrete type without a type assertion is not allowed.Actual Behavior
In Gno, the code compiles and executes successfully, producing the output:
The text was updated successfully, but these errors were encountered: