Skip to content

Error location has recently shifted for parse error #10930

@mischnic

Description

@mischnic

Describe the bug

The error location for parse errors has shifted between 1.13.1 and 1.13.2

Input code

import * as React from 'react';
let i = 0
setInterval(() => {
  i++
  throw Error('no ' + i)
}, 1000)
export default function FunctionNamed() {

Config

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "jsx": false
    },
    "target": "es3",
    "loose": false,
    "minify": {
      "compress": {
        "arguments": false,
        "arrows": true,
        "booleans": true,
        "booleans_as_integers": false,
        "collapse_vars": true,
        "comparisons": true,
        "computed_props": true,
        "conditionals": true,
        "dead_code": true,
        "directives": true,
        "drop_console": false,
        "drop_debugger": true,
        "evaluate": true,
        "expression": false,
        "hoist_funs": false,
        "hoist_props": true,
        "hoist_vars": false,
        "if_return": true,
        "join_vars": true,
        "keep_classnames": false,
        "keep_fargs": true,
        "keep_fnames": false,
        "keep_infinity": false,
        "loops": true,
        "negate_iife": true,
        "properties": true,
        "reduce_funcs": false,
        "reduce_vars": false,
        "side_effects": true,
        "switches": true,
        "typeofs": true,
        "unsafe": false,
        "unsafe_arrows": false,
        "unsafe_comps": false,
        "unsafe_Function": false,
        "unsafe_math": false,
        "unsafe_symbols": false,
        "unsafe_methods": false,
        "unsafe_proto": false,
        "unsafe_regexp": false,
        "unsafe_undefined": false,
        "unused": true,
        "const_to_let": true,
        "pristine_globals": true
      },
      "mangle": {
        "toplevel": false,
        "keep_classnames": false,
        "keep_fnames": false,
        "keep_private_props": false,
        "ie8": false,
        "safari10": false
      }
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": true,
  "isModule": true
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.13.1&code=H4sIAAAAAAAAAy2NsQoCMRAF%2B3zF65IYi1jL2SnYWPgH4W4PA5es7O2pcPjvRrEZpprJ5c6i2CDNuFLqFaNwgZWv272ZSJHRIZqZ9FyV5JEm5zy6A1YD5BAa9Sb8xFGExdnKsAjI3ry32MUYvaHX7zLQmJapLZbaa%2BaK018uqdDQousHfRRTK48AAAA%3D&config=H4sIAAAAAAAAA42VS47bMAxA93OKwOsuWhQoih6gu55BUCzKUSqLhkhlEgxy99KyncmMaaObIObjR6RI6u3lcGjO1Da%2FDm%2FyVz4Gmwny41skdEtsryJpoO0ttTkM3HxZ6JlG5G0kqKL7RBq2uQOuVvR9Vm8iIsGiPsv6kIK%2FPQdssR8yED3JRCr%2BSg%2BJ6aP9zDK%2BjoBzeZYfESPYtEOMJRMSQwdZc9xijHYgMBebFS%2FjSW0OhFqIERYGZ4aMg8qTCxwwScw1dWCdadGBgkKGlsMFNDOJJWaJJD0ln4odHEvX1Uv%2BZA0XG4tlJSZc65XIaRWvJwzExpeklXCCGzWY4Fzcz5bBmwxcclrbnTGkjTv5CyAViJYo2R40v1XDSz9tWftdy5C8tCzfFC79rWWZoJOimhC8UtmxMpA5aLeZwZUWxsq22nFmvFE%2BCg4MeC%2B9orim18DtSQvKtwHQK0Du13qtqyZgHlO4wceB2MG%2FJUvWG2zW6C2ftind%2BiPGnQA98AndjoJcBeM2zrIlrsM2L8mBtAY4VaVQBeslIAPAaGJdlqvekPEQj6aLeHxfE7PC%2FbGEe5u6Ou9P%2B5JxiHCBuNXG%2FzEiu1TOdhm7epns1fTCT60prQxe%2BPb1w5shqbwsvzWppkdXnhKqPTm9JT%2Bad6Xl5Viq1gT6sxjWOt3%2FAb40MYfgBgAA

SWC Info output

No response

Expected behavior

1.13.1

Image

Actual behavior

1.13.2

Image

Version

1.13.2

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions