syntax
syntax copied to clipboard
\"==" unexpectedly compiles to === instead of caml_equal
I would expect \"==" to compile to Caml_obj.caml_equal, just like == does, but instead it compiles to ===:
type eq<'t> = ('t, 't) => bool
type t
@val external x: t = "x"
@val external y: t = "y"
let comp = eq => eq(x, y)
Js.Console.log2("== normal", comp((a, b) => a == b))
Js.Console.log2("== escaped", comp(\"=="))
Js.Console.log2("=== normal", comp((a, b) => a === b))
// "The value === can't be found":
//Js.Console.log2("=== escaped", comp(\"==="))
// Generated by ReScript, PLEASE EDIT WITH CARE
'use strict';
var Curry = require("./stdlib/curry.js");
var Caml_obj = require("./stdlib/caml_obj.js");
function comp(eq) {
return Curry._2(eq, x, y);
}
console.log("== normal", Caml_obj.caml_equal(x, y));
console.log("== escaped", x === y);
console.log("=== normal", x === y);
exports.comp = comp;
/* Not a pure module */
This might be related to #335?
The rescript-lang/syntax repo is obsolete and will be archived soon. If this issue is still relevant, please reopen in the compiler repo (https://github.com/rescript-lang/rescript-compiler) or comment here to ask for it to be moved. Thank you for your contributions.