github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/types/testdata/check/unions.go (about)

     1  // Copyright 2021 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Check that overlong unions don't bog down type checking.
     6  // Disallow them for now.
     7  
     8  package p
     9  
    10  type t int
    11  
    12  type (
    13  	t00 t; t01 t; t02 t; t03 t; t04 t; t05 t; t06 t; t07 t; t08 t; t09 t
    14  	t10 t; t11 t; t12 t; t13 t; t14 t; t15 t; t16 t; t17 t; t18 t; t19 t
    15  	t20 t; t21 t; t22 t; t23 t; t24 t; t25 t; t26 t; t27 t; t28 t; t29 t
    16  	t30 t; t31 t; t32 t; t33 t; t34 t; t35 t; t36 t; t37 t; t38 t; t39 t
    17  	t40 t; t41 t; t42 t; t43 t; t44 t; t45 t; t46 t; t47 t; t48 t; t49 t
    18  	t50 t; t51 t; t52 t; t53 t; t54 t; t55 t; t56 t; t57 t; t58 t; t59 t
    19  	t60 t; t61 t; t62 t; t63 t; t64 t; t65 t; t66 t; t67 t; t68 t; t69 t
    20  	t70 t; t71 t; t72 t; t73 t; t74 t; t75 t; t76 t; t77 t; t78 t; t79 t
    21  	t80 t; t81 t; t82 t; t83 t; t84 t; t85 t; t86 t; t87 t; t88 t; t89 t
    22  	t90 t; t91 t; t92 t; t93 t; t94 t; t95 t; t96 t; t97 t; t98 t; t99 t
    23  )
    24  
    25  type u99 interface {
    26  	t00|t01|t02|t03|t04|t05|t06|t07|t08|t09|
    27  	t10|t11|t12|t13|t14|t15|t16|t17|t18|t19|
    28  	t20|t21|t22|t23|t24|t25|t26|t27|t28|t29|
    29  	t30|t31|t32|t33|t34|t35|t36|t37|t38|t39|
    30  	t40|t41|t42|t43|t44|t45|t46|t47|t48|t49|
    31  	t50|t51|t52|t53|t54|t55|t56|t57|t58|t59|
    32  	t60|t61|t62|t63|t64|t65|t66|t67|t68|t69|
    33  	t70|t71|t72|t73|t74|t75|t76|t77|t78|t79|
    34  	t80|t81|t82|t83|t84|t85|t86|t87|t88|t89|
    35  	t90|t91|t92|t93|t94|t95|t96|t97|t98
    36  }
    37  
    38  type u100a interface {
    39  	u99|float32
    40  }
    41  
    42  type u100b interface {
    43  	u99|float64
    44  }
    45  
    46  type u101 interface {
    47  	t00|t01|t02|t03|t04|t05|t06|t07|t08|t09|
    48  	t10|t11|t12|t13|t14|t15|t16|t17|t18|t19|
    49  	t20|t21|t22|t23|t24|t25|t26|t27|t28|t29|
    50  	t30|t31|t32|t33|t34|t35|t36|t37|t38|t39|
    51  	t40|t41|t42|t43|t44|t45|t46|t47|t48|t49|
    52  	t50|t51|t52|t53|t54|t55|t56|t57|t58|t59|
    53  	t60|t61|t62|t63|t64|t65|t66|t67|t68|t69|
    54  	t70|t71|t72|t73|t74|t75|t76|t77|t78|t79|
    55  	t80|t81|t82|t83|t84|t85|t86|t87|t88|t89|
    56  	t90|t91|t92|t93|t94|t95|t96|t97|t98|t99|
    57          int // ERROR "cannot handle more than 100 union terms"
    58  }
    59  
    60  type u102 interface {
    61          int /* ERROR "cannot handle more than 100 union terms" */ |string|u100a
    62  }
    63  
    64  type u200 interface {
    65          u100a /* ERROR "cannot handle more than 100 union terms" */ |u100b
    66  }