#name: list types
#evalPartial
-- in.cue --
import "list"

l0: list.Repeat([int], 3)
l0: [1, 2, 3]
l2: [...{a: int}]
l2: [{a: 1}, {a: 2, b: 3}]

// TODO: work out a decent way to specify length ranges of lists.
// l3: <=10*[int]
// l3: [1, 2, 3, ...]

s1: (list.Repeat([int], 6))[2:3]
s2: [0, 2, 3][1:2]

i1: (list.Repeat([int], 6))[2]
i2: [0, 2, 3][2]

t0: [...{a: 8}]
t0: [{}]
t1: [...]
t1: [...int]

e0: list.Repeat([{}], 2)
e0: [{}]
e1: [...int]
e1: [...float]
-- out/def --
l0: [1, 2, 3]
l2: [{
	a: 1
}, {
	a: 2
	b: 3
}]
s1: [int]
s2: [2]
i1: [int, int, int, int, int, int][2]
i2: 3
t0: [{
	a: 8
}]
t1: [...int]
e0: _|_ // conflicting list lengths: conflicting values 2 and 1
e1: [..._|_ // conflicting values int and float (mismatched types int and float),
]
-- out/legacy-debug --
<0>{l0: [1,2,3], l2: [<1>{a: 1},<2>{a: 2, b: 3}], s1: [int], s2: [2], i1: int, i2: 3, t0: [<3>{a: 8}], t1: [, ...int], e0: _|_(([<4>{},<4>{}] & [<5>{}]):conflicting list lengths: conflicting values 2 and 1), e1: [, ..._|_((int & float):conflicting values int and float (mismatched types int and float))]}
-- out/compile --
--- in.cue
{
  l0: 〈import;list〉.Repeat([
    int,
  ], 3)
  l0: [
    1,
    2,
    3,
  ]
  l2: [
    ...{
      a: int
    },
  ]
  l2: [
    {
      a: 1
    },
    {
      a: 2
      b: 3
    },
  ]
  s1: 〈import;list〉.Repeat([
    int,
  ], 6)[2:3]
  s2: [
    0,
    2,
    3,
  ][1:2]
  i1: 〈import;list〉.Repeat([
    int,
  ], 6)[2]
  i2: [
    0,
    2,
    3,
  ][2]
  t0: [
    ...{
      a: 8
    },
  ]
  t0: [
    {},
  ]
  t1: [
    ...,
  ]
  t1: [
    ...int,
  ]
  e0: 〈import;list〉.Repeat([
    {},
  ], 2)
  e0: [
    {},
  ]
  e1: [
    ...int,
  ]
  e1: [
    ...float,
  ]
}
-- out/eval/stats --
Leaks:  3
Freed:  33
Reused: 29
Allocs: 7
Retain: 7

Unifications: 36
Conjuncts:    59
Disjuncts:    39
-- out/evalalpha --
Errors:
e0: incompatible list lengths (1 and 2):
    _:1:2

Result:
(_|_){
  // [eval]
  l0: (#list){
    0: (int){ 1 }
    1: (int){ 2 }
    2: (int){ 3 }
  }
  l2: (#list){
    0: (struct){
      a: (int){ 1 }
    }
    1: (struct){
      a: (int){ 2 }
      b: (int){ 3 }
    }
  }
  s1: (#list){
    0: (int){ int }
  }
  s2: (#list){
    0: (int){ 2 }
  }
  i1: (int){ int }
  i2: (int){ 3 }
  t0: (#list){
    0: (struct){
      a: (int){ 8 }
    }
  }
  t1: (list){
  }
  e0: (_|_){
    // [eval] e0: incompatible list lengths (1 and 2):
    //     _:1:2
    0: (struct){
    }
    1: (struct){
    }
  }
  e1: (list){
  }
}
-- diff/-out/evalalpha<==>+out/eval --
diff old new
--- old
+++ new
@@ -1,5 +1,6 @@
 Errors:
-e0: incompatible list lengths (1 and 2)
+e0: incompatible list lengths (1 and 2):
+    _:1:2
 
 Result:
 (_|_){
@@ -34,7 +35,8 @@
   t1: (list){
   }
   e0: (_|_){
-    // [eval] e0: incompatible list lengths (1 and 2)
+    // [eval] e0: incompatible list lengths (1 and 2):
+    //     _:1:2
     0: (struct){
     }
     1: (struct){
-- out/eval --
Errors:
e0: incompatible list lengths (1 and 2)

Result:
(_|_){
  // [eval]
  l0: (#list){
    0: (int){ 1 }
    1: (int){ 2 }
    2: (int){ 3 }
  }
  l2: (#list){
    0: (struct){
      a: (int){ 1 }
    }
    1: (struct){
      a: (int){ 2 }
      b: (int){ 3 }
    }
  }
  s1: (#list){
    0: (int){ int }
  }
  s2: (#list){
    0: (int){ 2 }
  }
  i1: (int){ int }
  i2: (int){ 3 }
  t0: (#list){
    0: (struct){
      a: (int){ 8 }
    }
  }
  t1: (list){
  }
  e0: (_|_){
    // [eval] e0: incompatible list lengths (1 and 2)
    0: (struct){
    }
    1: (struct){
    }
  }
  e1: (list){
  }
}
