]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/go/types/errorcodes.go
[dev.typeparams] merge master (2f0da6d) into dev.typeparams
[gostls13.git] / src / go / types / errorcodes.go
index ac28c3bd13443d65e3db53b41086a92e5751f315..1e39aed07d619cc59b5a8dcbe5d6022f95a515de 100644 (file)
@@ -6,6 +6,9 @@ package types
 
 type errorCode int
 
+// TODO(rFindley): ensure that existing error codes do not change in the
+//                 dev.typeparams branch.
+
 // This file defines the error codes that can be produced during type-checking.
 // Collectively, these codes provide an identifier that may be used to
 // implement special handling for certain types of errors.
@@ -756,52 +759,12 @@ const (
        _NonVariadicDotDotDot
 
        // _MisplacedDotDotDot occurs when a "..." is used somewhere other than the
-       // final argument to a function call.
+       // final argument in a function declaration.
        //
        // Example:
-       //  func printArgs(args ...int) {
-       //      for _, a := range args {
-       //              println(a)
-       //      }
-       //  }
-       //
-       //  func f() {
-       //      a := []int{1,2,3}
-       //      printArgs(0, a...)
-       //  }
+       //      func f(...int, int)
        _MisplacedDotDotDot
 
-       // _InvalidDotDotDotOperand occurs when a "..." operator is applied to a
-       // single-valued operand.
-       //
-       // Example:
-       //  func printArgs(args ...int) {
-       //      for _, a := range args {
-       //              println(a)
-       //      }
-       //  }
-       //
-       //  func f() {
-       //      a := 1
-       //      printArgs(a...)
-       //  }
-       //
-       // Example:
-       //  func args() (int, int) {
-       //      return 1, 2
-       //  }
-       //
-       //  func printArgs(args ...int) {
-       //      for _, a := range args {
-       //              println(a)
-       //      }
-       //  }
-       //
-       //  func g() {
-       //      printArgs(args()...)
-       //  }
-       _InvalidDotDotDotOperand
-
        // _InvalidDotDotDot occurs when a "..." is used in a non-variadic built-in
        // function.
        //
@@ -1081,18 +1044,6 @@ const (
        //  }
        _InvalidPostDecl
 
-       // _InvalidChanRange occurs when a send-only channel used in a range
-       // expression.
-       //
-       // Example:
-       //  func sum(c chan<- int) {
-       //      s := 0
-       //      for i := range c {
-       //              s += i
-       //      }
-       //  }
-       _InvalidChanRange
-
        // _InvalidIterVar occurs when two iteration variables are used while ranging
        // over a channel.
        //
@@ -1369,4 +1320,8 @@ const (
 
        // _BadDecl occurs when a declaration has invalid syntax.
        _BadDecl
+
+       // _Todo is a placeholder for error codes that have not been decided.
+       // TODO(rFindley) remove this error code after deciding on errors for generics code.
+       _Todo
 )