rokucommunity / rokucommunity/brighterscript

Add diagnostic for "Internal limit size exceeded"

Open
#1,427 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

There's a compile-time exception related to logical expressions and AA/Array literals. Not entirely sure why this happens, but we should dig in further to try and add some diagnostics to flag against some of these situations.

here are some examples. All of these will fail with the code provided, but removing 1 element will fix the compile error. Also, some of these are runtime exceptions, but we wanted to show the cleanest code possible. Wrapping them in function calls or comparing to invalid will result in the same compile error:


  ' an array with 25 numbers
  if true and [
      1, 2, 3, 4, 5, 6, 7, 8, 9
      10, 11, 12, 13, 14, 15, 16, 17, 18, 19
      20, 21, 22, 23, 24, 25
    ] <> invalid then
  end if

  ' an array with 22 numbers and 1 aa having 3 props
  if true and [
      1, 2, 3, 4, 5, 6, 7, 8, 9
      10, 11, 12, 13, 14, 15, 16, 17, 18, 19
      20, 21, 22, {
        a: 23,
        b: 24,
        c: 25
      }
    ] then
  end if

  ' an array with 1 aa having 38 integer props
  if true and [
      {
        a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9
        j: 10, k: 11, l: 12, m: 13, n: 14, o: 15, p: 16, q: 17, r: 18, s: 19,
        t: 20, u: 21, v: 22, w: 23, x: 24, y: 25, z: 26,
        aa: 27,
        bb: 28,
        cc: 29
        dd: 30,
        ee: 31
        ff: 32
        gg: 33
        hh: 34
        ii: 35
        jj: 36
        kk: 37
        ll: 38
    }] <> invalid then
  end if

  ' an array with 2 AAs having a combined 38 integer props
  if true and [
      {
        a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10,
        k: 11, l: 12, m: 13, n: 14, o: 15, p: 16, q: 17, r: 18, s: 19, t: 20,
        u: 21, v: 22, w: 23, x: 24, y: 25, z: 26
      }, {
        aa: 27,
        bb: 28,
        cc: 29
        dd: 30,
        ee: 31
        ff: 32
        gg: 33
        hh: 34
        ii: 35
        jj: 36
        kk: 37
        ll: 38
    }] <> invalid then
  end if

  ' an AA with 40 integer props
  if true and {
      a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10,
      k: 11, l: 12, m: 13, n: 14, o: 15, p: 16, q: 17, r: 18, s: 19, t: 20,
      u: 21, v: 22, w: 23, x: 24, y: 25, z: 26, aa: 27, bb: 28, cc: 29, dd: 30,
      ee: 31, ff: 32, gg: 33, hh: 34, ii: 35, jj: 36, kk: 37, ll: 38, mm: 39, nn: 40,
    } <> invalid then
  end if

  ' 34 integers in chained AND statements
  if 1 and 2 and 3 and 4 and 5 and 6 and 7 and 8 and 9 and 10 and 11 and 12 and 13 and 14 and 15 and 16 and 17 and 18 and 19 and 20 and 21 and 22 and 23 and 24 and 25 and 26 and 27 and 28 and 29 and 30 and 31 and 32 and 33 and 34
  end if

  ' 34 n=n in chained AND statements
  if 1 = 1 and 2 = 2 and 3 = 3 and 4 = 4 and 5 = 5 and 6 = 6 and 7 = 7 and 8 = 8 and 9 = 9 and 10 = 10 and 11 = 11 and 12 = 12 and 13 = 13 and 14 = 14 and 15 = 15 and 16 = 16 and 17 = 17 and 18 = 18 and 19 = 19 and 20 = 20 and 21 = 21 and 22 = 22 and 23 = 23 and 24 = 24 and 25 = 25 and 26 = 26 and 27 = 27 and 28 = 28 and 29 = 29 and 30 = 30 and 31 = 31 and 32 = 32 and 33 = 33 and 34 = 34 then
  end if


  ' 34 string elements in chained AND statements
  if "11111" and "22222" and "33333" and "44444" and "55555" and "66666" and "77777" and "88888" and "99999" and "1010101010" and "1111111111" and "1212121212" and "1313131313" and "1414141414" and "1515151515" and "1616161616" and "1717171717" and "1818181818" and "1919191919" and "2020202020" and "2121212121" and "2222222222" and "2323232323" and "2424242424" and "2525252525" and "2626262626" and "2727272727" and "2828282828" and "2929292929" and "3030303030" and "3131313131" and "3232323232" and "3333333333" and "3434343434"
  end if

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the compile-time “Internal limit size exceeded” exception with the BrightScript logical-expression, array-literal, and associative-array examples in the issue. Trace the compiler entry point that handles these expressions and define diagnostics for the demonstrated cases; done means the examples report a useful diagnostic instead of only the internal exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.