-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
176 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a int = -1 | ||
println(uint(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6.gno:5:10: cannot convert constant of type IntKind to UintKind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a int = -1 | ||
println(uint8(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6a.gno:5:10: cannot convert constant of type IntKind to Uint8Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a int = -1 | ||
println(uint16(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6b.gno:5:10: cannot convert constant of type IntKind to Uint16Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a int = -1 | ||
println(uint32(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6c.gno:5:10: cannot convert constant of type IntKind to Uint32Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a int = -1 | ||
println(uint64(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6d.gno:5:10: cannot convert constant of type IntKind to Uint64Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a float32 = 1.5 | ||
println(int32(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert6e.gno:5:10: cannot convert constant of type Float32Kind to Int32Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package main | ||
|
||
func main() { | ||
println(int32(1.5)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert7.gno:4:10: cannot convert (const (1.5 <untyped> bigdec)) to integer type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const a float64 = 1.5 | ||
println(int64(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert7a.gno:5:10: cannot convert constant of type Float64Kind to Int64Kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package main | ||
|
||
func main() { | ||
println(int64(1.5)) | ||
} | ||
|
||
// Error: | ||
// main/files/convert7b.gno:4:10: cannot convert (const (1.5 <untyped> bigdec)) to integer type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
func main() { | ||
const f = float64(1.0) | ||
println(int64(f)) | ||
} | ||
|
||
// Output: | ||
// 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
type Runner interface { | ||
Run() | ||
} | ||
|
||
type Swimmer interface { | ||
Swim() | ||
} | ||
|
||
func main() { | ||
a := Runner(nil) | ||
println(Swimmer(a)) | ||
} | ||
|
||
// Error: | ||
// main/files/interface47.gno:13:10: main.Runner does not implement main.Swimmer (missing method Swim) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
type Writer interface { | ||
Write([]byte) (int, error) | ||
} | ||
|
||
type Stringer interface { | ||
String() string | ||
} | ||
|
||
func main() { | ||
var x interface { | ||
Writer | ||
Stringer | ||
} | ||
var w Writer = Writer(x) // explicit conversion | ||
println(w) | ||
} | ||
|
||
// Output: | ||
// nil |
Oops, something went wrong.