Skip to content

Compiler crash with RangeError: Map maximum size exceeded #61493

Closed as not planned
@liyanch

Description

@liyanch

🔎 Search Terms

RangeError: Map maximum size exceeded.

PS: The problem seems as the content of links, #55630 and #53192. But there is not same as the problem. I hope I can get the correct answer to solve the error.

🕗 Version & Regression Information

  • This changed between versions v4.9.5.
  • I was unable to test this on prior versions because the compilation tool is based on v4.9.5. and most products are based on this compilation tool.

⏯ Playground Link

No response

💻 Code

// Your code here
// Like this, but not same as this.
// For details, see the error reporting function of the error stack.
type Digits = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
type T1 = `${Digits}${Digits}${Digits}${Digits}` | undefined;
type T2 = { a: string } | { b: number };

export function f1(x: T1 | null, y: T1 & T2) {
x = y; // Excessive complexity error
}

// Or like this
type Digits = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
type T9XXXX = `9${Digits}${Digits}${Digits}${Digits}`;
type TXXXXX = `${Exclude<Digits, '0'>}${Digits}${Digits}${Digits}${Digits}`;
let x: Exclude<TXXXXX, T9XXXX> = '88888';

🙁 Actual behavior

The error stack information is as follows:
RangeError: Map maximum size exceeded
at Map.set ()
at recursiveTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:68762:30)
at isRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:68255:25)
at checkTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:67869:26)
at isTypeRelatedTo (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:67809:24)
at removeSubtypes (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:64284:33)
at getUnionType (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:64388:31)
at checkArrayLiteral (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:76781:17)
at checkExpressionWorker (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:83794:28)
at checkExpression (/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/ets/build-tools/ets-loader/node_modules/typescript/lib/typescript.js:83713:38)

hvigor ERROR: BUILD FAILED in 3 min 20 s 692 ms

Process finished with exit code -1

🙂 Expected behavior

hvigor SUCCESS: BUILD SUCCESSFUL in 3 min 20 s 692 ms

Process finished with exit code 0

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    UnactionableThere isn't something we can do with this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions