Skip to content

Calling an operator method without an argument causes a crash #1385

@Cheatoid

Description

@Cheatoid

Steps to reproduce

  1. Download and extract the example project: operator-call-crash.zip.
  2. Run npm install & npm run build, and then a crash would occur.

Build output

> build
> tstl

Loaded 0 plugins
Parsing project settings
Transforming ~/operator-call-crash/src/main.ts
~\operator-call-crash\node_modules\typescript\lib\typescript.js:120324
                throw e;
                ^

TypeError: Cannot read properties of undefined (reading 'kind')
    at Object.canHaveModifiers (~\operator-call-crash\node_modules\typescript\lib\typescript.js:31128:25)
    at TransformationContext.transformNodeRaw (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\context\context.js:51:16)
    at TransformationContext.transformExpression (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\context\context.js:81:29)
    at transformBinaryOperator (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\visitors\language-extensions\operators.js:86:47)
    at transformLanguageExtensionCallExpression (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\visitors\language-extensions\call-extension.js:19:16)
    at transformCallExpression (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\visitors\call.js:159:202)
    at TransformationContext.transformNodeRaw (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\context\context.js:65:24)
    at TransformationContext.transformExpression (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\context\context.js:81:29)
    at ~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\visitors\expression-list.js:37:147
    at transformInPrecedingStatementScope (~\operator-call-crash\node_modules\typescript-to-lua\dist\transformation\utils\preceding-statements.js:6:35)

Node.js v18.13.0
TS v4.9.4
TSTL v1.12.0

This is mostly annoying if you're using tstl in watch mode (--watch option).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions