-- x.cue -- // variants of fib inline: small: { f: { n: int out: (f & {"n": n - 1}).out } } inline: medium: { f2: (f & {n: 2}).out fRec: {nn: int, out: (f & {n: nn}).out} f: { n: int out: (fRec & {nn: n - 1}).out } } inline: patterns: { f: n: (f & {n: {}}).n f: n: {} [string]: {n: {}} f: [string]: {} f: {} } inline: acrossFields: fail1: { f: { in: number out: in + 1 } k00: 0 k10: (f & {in: k00}).out k20: (f & {in: k10}).out k30: (f & {in: k20}).out // invalid recursion is here. k10: (f & {in: k30}).out } // Issue #2163 inline: acrossFields: ok1: { f: { in: number out: in } k00: 0 k10: (f & {in: k00}).out k20: (f & {in: k10}).out k30: (f & {in: k20}).out // TODO: what is correct behavior here. // This is borderline okay. k10: (f & {in: k30}).out } -- out/compile -- --- x.cue { inline: { small: { f: { n: int out: (〈1;f〉 & { n: (〈1;n〉 - 1) }).out } } } inline: { medium: { f2: (〈0;f〉 & { n: 2 }).out fRec: { nn: int out: (〈1;f〉 & { n: 〈1;nn〉 }).out } f: { n: int out: (〈1;fRec〉 & { nn: (〈1;n〉 - 1) }).out } } } inline: { patterns: { f: { n: (〈1;f〉 & { n: {} }).n } f: { n: {} } [string]: { n: {} } f: { [string]: {} } f: {} } } inline: { acrossFields: { fail1: { f: { in: number out: (〈0;in〉 + 1) } k00: 0 k10: (〈0;f〉 & { in: 〈1;k00〉 }).out k20: (〈0;f〉 & { in: 〈1;k10〉 }).out k30: (〈0;f〉 & { in: 〈1;k20〉 }).out k10: (〈0;f〉 & { in: 〈1;k30〉 }).out } } } inline: { acrossFields: { ok1: { f: { in: number out: 〈0;in〉 } k00: 0 k10: (〈0;f〉 & { in: 〈1;k00〉 }).out k20: (〈0;f〉 & { in: 〈1;k10〉 }).out k30: (〈0;f〉 & { in: 〈1;k20〉 }).out k10: (〈0;f〉 & { in: 〈1;k30〉 }).out } } } } -- out/eval/stats -- Leaks: 247 Freed: 141 Reused: 136 Allocs: 252 Retain: 834 Unifications: 388 Conjuncts: 1307 Disjuncts: 707 -- out/eval -- Errors: structural cycle: ./x.cue:6:9 structural cycle: ./x.cue:15:9 structural cycle: ./x.cue:20:9 in: structural cycle: ./x.cue:30:8 Result: (_|_){ // [structural cycle] inline: (_|_){ // [structural cycle] small: (_|_){ // [structural cycle] f: (_|_){ // [structural cycle] n: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:6:9 } } } medium: (_|_){ // [structural cycle] f2: (_|_){ // [structural cycle] structural cycle: // ./x.cue:15:9 } fRec: (_|_){ // [structural cycle] nn: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:15:9 } } f: (_|_){ // [structural cycle] n: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:15:9 } } } patterns: (_|_){ // [structural cycle] f: (_|_){ // [structural cycle] n: (_|_){ // [structural cycle] structural cycle: // ./x.cue:20:9 } } } acrossFields: (_|_){ // [structural cycle] fail1: (_|_){ // [structural cycle] f: (struct){ in: (number){ number } out: (_|_){ // [incomplete] inline.acrossFields.fail1.f.out: non-concrete value number in operand to +: // ./x.cue:30:8 // ./x.cue:29:8 } } k00: (int){ 0 } k10: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:30:8 } k20: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:30:8 } k30: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:30:8 } } ok1: (struct){ f: (struct){ in: (number){ number } out: (number){ number } } k00: (int){ 0 } k10: (int){ 0 } k20: (int){ 0 } k30: (int){ 0 } } } } } -- out/evalalpha -- Errors: structural cycle: ./x.cue:6:9 structural cycle: ./x.cue:12:24 structural cycle: ./x.cue:15:9 structural cycle: ./x.cue:20:9 in: structural cycle: ./x.cue:34:17 in: structural cycle: ./x.cue:35:17 in: structural cycle: ./x.cue:38:17 in: structural cycle: ./x.cue:49:17 in: structural cycle: ./x.cue:50:17 in: structural cycle: ./x.cue:54:17 Result: (_|_){ // [structural cycle] inline: (_|_){ // [structural cycle] small: (_|_){ // [structural cycle] f: (_|_){ // [structural cycle] n: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:6:9 } } } medium: (_|_){ // [structural cycle] f2: (_|_){ // [structural cycle] structural cycle: // ./x.cue:15:9 } fRec: (_|_){ // [structural cycle] nn: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:12:24 } } f: (_|_){ // [structural cycle] n: (int){ int } out: (_|_){ // [structural cycle] structural cycle: // ./x.cue:15:9 } } } patterns: (_|_){ // [structural cycle] f: (_|_){ // [structural cycle] n: (_|_){ // [structural cycle] structural cycle: // ./x.cue:20:9 } } } acrossFields: (_|_){ // [structural cycle] fail1: (_|_){ // [structural cycle] f: (struct){ in: (number){ number } out: (_|_){ // [incomplete] inline.acrossFields.fail1.f.out: non-concrete value number in operand to +: // ./x.cue:30:8 // ./x.cue:29:8 } } k00: (int){ 0 } k10: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:38:17 } k20: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:34:17 } k30: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:35:17 } } ok1: (_|_){ // [structural cycle] f: (struct){ in: (number){ number } out: (number){ number } } k00: (int){ 0 } k10: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:54:17 } k20: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:49:17 } k30: (_|_){ // [structural cycle] in: structural cycle: // ./x.cue:50:17 } } } } } -- diff/-out/evalalpha<==>+out/eval -- diff old new --- old +++ new @@ -2,11 +2,23 @@ structural cycle: ./x.cue:6:9 structural cycle: + ./x.cue:12:24 +structural cycle: ./x.cue:15:9 structural cycle: ./x.cue:20:9 in: structural cycle: - ./x.cue:30:8 + ./x.cue:34:17 +in: structural cycle: + ./x.cue:35:17 +in: structural cycle: + ./x.cue:38:17 +in: structural cycle: + ./x.cue:49:17 +in: structural cycle: + ./x.cue:50:17 +in: structural cycle: + ./x.cue:54:17 Result: (_|_){ @@ -35,7 +47,7 @@ nn: (int){ int } out: (_|_){ // [structural cycle] structural cycle: - // ./x.cue:15:9 + // ./x.cue:12:24 } } f: (_|_){ @@ -72,26 +84,36 @@ k00: (int){ 0 } k10: (_|_){ // [structural cycle] in: structural cycle: - // ./x.cue:30:8 - } - k20: (_|_){ - // [structural cycle] in: structural cycle: - // ./x.cue:30:8 - } - k30: (_|_){ - // [structural cycle] in: structural cycle: - // ./x.cue:30:8 - } - } - ok1: (struct){ + // ./x.cue:38:17 + } + k20: (_|_){ + // [structural cycle] in: structural cycle: + // ./x.cue:34:17 + } + k30: (_|_){ + // [structural cycle] in: structural cycle: + // ./x.cue:35:17 + } + } + ok1: (_|_){ + // [structural cycle] f: (struct){ in: (number){ number } out: (number){ number } } k00: (int){ 0 } - k10: (int){ 0 } - k20: (int){ 0 } - k30: (int){ 0 } + k10: (_|_){ + // [structural cycle] in: structural cycle: + // ./x.cue:54:17 + } + k20: (_|_){ + // [structural cycle] in: structural cycle: + // ./x.cue:49:17 + } + k30: (_|_){ + // [structural cycle] in: structural cycle: + // ./x.cue:50:17 + } } } } -- diff/todo/p2 -- One test now fails. Given TODO, this may be okay. This does break Issue #2163.