-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
untypedconst.go
67 lines (54 loc) · 1.28 KB
/
untypedconst.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//golangcitest:args -Euntypedconst
package testdata
import (
"fmt"
)
type ExString string
func retExString() ExString {
if true {
return ExString("hoge")
} else {
fmt.Println("This should never happen")
return "hoge" // want `returning untyped constant as defined type "command-line-arguments.ExString"`
}
}
type ExInt int
func retExInt() ExInt {
if true {
return ExInt(1)
} else {
return 1 // want `returning untyped constant as defined type "command-line-arguments.ExInt"`
}
}
type ExFloat float64
func retExFloat() ExFloat {
if true {
return ExFloat(0.5)
} else {
return 0.5 // want `returning untyped constant as defined type "command-line-arguments.ExFloat"`
}
}
type ExComplex complex128
func retExComplex() ExComplex {
if true {
return ExComplex(1.0 + 0.5i)
} else {
return 1.0 + 0.5i // want `returning untyped constant as defined type "command-line-arguments.ExComplex"`
}
}
type ExRune rune
func retExRune() ExRune {
if true {
return ExRune('a')
} else {
return 'a' // want `returning untyped constant as defined type "command-line-arguments.ExRune"`
}
}
type ExBool bool
func retExBool() ExBool {
if true {
return ExBool(true)
} else {
return true // want `returning untyped constant as defined type "command-line-arguments.ExBool"`
}
}