Skip to content

-ddump-json does not escape quotes properly

Steps to reproduce

This program

module StringError where

q = "string" + "string"

Compiled with -ddump-json, produces this JSON output:

[
 {"span": {"file": "tmp.hs","startLine": 3,"startCol": 5,"endLine": 3,"endCol": 24},"doc": "\u2022 No instance for (Num [Char]) arising f
rom a use of \u2018+\u2019\n\u2022 In the expression: "string" + "string"\n  In an equation for \u2018q\u2019: q = "string" + "string"","
severity": "SevError","reason": null}]

It is not valid JSON, because "string" occured in a JSON string, but the quotes are not escaped.

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC mpickering
Operating system
Architecture
Edited by dramforever
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information