FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Runtime error of compiled code due to unicode char · Issue #4590 · purescript/purescript · GitHub

Runtime error of compiled code due to unicode char #4590

Description

Description

Usage of unicode char ² in type name is allowed by purs compiler but fails in node at runtime
A clear and concise description of what the bug is.

To Reproduce

-- Example.purs
module Example where

data ℝ² = V Number Number
derive instance Generic ℝ² _
instance Show ℝ² where
    show = genericShow

v :: ℝ²
v = V 1.0 2.0

in spago repl

# spago repl
> import Example
> v
file:///{path_to_project}/.psci_modules/$PSCI/index.js:4
var $dollarmain = /* #__PURE__ */ PSCI_Support["eval"](/* #__PURE__ */ PSCI_Support.evalShow(Temp2.showℝ²))(it);
                                                                                                   ^^^^^

SyntaxError: missing ) after argument list
    at compileSourceTextModule (node:internal/modules/esm/utils:338:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:468:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:515:27)
    at async ModuleJob._link (node:internal/modules/esm/module_job:115:19)

Node.js v22.14.0

Expected behavior

Either

  1. compiler to transform the name so that the runtime js error doesn't happen
  2. compiler to not allow that unicode char (but what a shame that would be!)

Additional context

spago version: 0.93.45 (not sure whether relevant)

PureScript version

0.15.15

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


    Back | FazBrowse Home | New Git URL