| package rank |
| |
| import "time" |
| |
| func _() { |
| type strList []string |
| wantsStrList := func(strList) {} |
| |
| var ( |
| convA string //@item(convertA, "convA", "string", "var") |
| convB []string //@item(convertB, "convB", "[]string", "var") |
| ) |
| wantsStrList(strList(conv)) //@complete("))", convertB, convertA) |
| } |
| |
| func _() { |
| type myInt int |
| |
| const ( |
| convC = "hi" //@item(convertC, "convC", "string", "const") |
| convD = 123 //@item(convertD, "convD", "int", "const") |
| convE int = 123 //@item(convertE, "convE", "int", "const") |
| convF string = "there" //@item(convertF, "convF", "string", "const") |
| convG myInt = 123 //@item(convertG, "convG", "myInt", "const") |
| ) |
| |
| var foo int |
| foo = conv //@rank(" //", convertE, convertD) |
| |
| var mi myInt |
| mi = conv //@rank(" //", convertG, convertD, convertE) |
| mi + conv //@rank(" //", convertG, convertD, convertE) |
| |
| 1 + conv //@rank(" //", convertD, convertC),rank(" //", convertE, convertC),rank(" //", convertG, convertC) |
| |
| type myString string |
| var ms myString |
| ms = conv //@rank(" //", convertC, convertF) |
| |
| type myUint uint32 |
| var mu myUint |
| mu = conv //@rank(" //", convertD, convertE) |
| |
| // don't downrank constants when assigning to interface{} |
| var _ interface{} = c //@rank(" //", convertD, complex) |
| |
| var _ time.Duration = conv //@rank(" //", convertD, convertE),snippet(" //", convertE, "time.Duration(convE)", "time.Duration(convE)") |
| |
| var convP myInt //@item(convertP, "convP", "myInt", "var") |
| var _ *int = conv //@snippet(" //", convertP, "(*int)(&convP)", "(*int)(&convP)") |
| |
| var ff float64 //@item(convertFloat, "ff", "float64", "var") |
| f == convD //@snippet(" =", convertFloat, "ff", "ff") |
| } |