Open rakudrama opened 4 years ago
Immediate issue above fixed by e0257265d34efffc845ea88643e183dc3cc5bb0e. Needs more testing to close.
Just want to confirm I'm seeing the same thing. Depending on whether using Chrome or Edge, I'm seeing $add or the C.JsString_methods error.
@edyu If you could include the stack trace I could tell if it is the same issue or something else.
from Chrome:
Uncaught TypeError: Cannot read property '$add' of undefined at Object._Universe__canonicalRecipeOfInterface (rti.dart:1746) at Object._Universe__lookupInterfaceRti (rti.dart:1755) at Object._Parser_handleTypeArguments (rti.dart:2258) at Object._Parser_parse (rti.dart:2140) at Object._Universe__parseRecipe (rti.dart:1509) at Object._Universe_eval (rti.dart:1442) at findType (rti.dart:405) at rtii (main.dart.js:69276) at dartProgram (main.dart.js:69741) at js_helper.dart:3221 _Universe__canonicalRecipeOfInterface @ rti.dart:1743 _Universe__lookupInterfaceRti @ rti.dart:1753 _Parser_handleTypeArguments @ rti.dart:2256 _Parser_parse @ rti.dart:2137 _Universe__parseRecipe @ rti.dart:1506 _Universe_eval @ rti.dart:1445 findType @ rti.dart:396 rtii @ main.dart.js:69276 dartProgram @ main.dart.js:69741 (anonymous) @ js_helper.dart:3221
From Firefox:
TypeError: C.JSString_methods is undefined _Universe__canonicalRecipeOfInterface rti.dart:1744 _Universe__lookupInterfaceRti rti.dart:1755 _Parser_handleTypeArguments rti.dart:2258 _Parser_parse rti.dart:2140 _Universe__parseRecipe rti.dart:1509 _Universe_eval rti.dart:1442 findType rti.dart:405 rtii main.dart.js:69276 dartProgram main.dart.js:69741main.dart.js:70694
@rakudrama I just posted the stack trace for both Chrome and Firefox. Here is the corresponding build.yaml:
targets: $default: builders: build_web_compilers|entrypoint: options: compiler: dart2js dart2js_args: - -O0
Thanks for the investigation. The bug fix e0257265d34efffc845ea88643e183dc3cc5bb0e is relatively recent and didn't make the cut for the most recent stable release (2.8.3) but will be in a future release (2.9 preview). In the meantime, use -O1
instead.
I just tried running the code in https://github.com/dart-lang/sdk/issues/41449 with
-O0
. The code fails with:There is an indirect cycle.
C.JSString
is a constant interceptor (methods) in the constant pool. The types are created (rtii
,findType
) for the type pool before the constant pool exists.Possible ways to fix this:
+
on Strings. Use a new_Utils.concatN(s1, s2, ..., sN)
methods inrti.dart
.+
(it lowers to HStringConcat and the staticS
helper)String.+
to be more like numbers - generate a check before the lowered+
operation.Pulling the interceptor constants earlier might be the best option since the others remedies don't apply if we find the same problem with a different interceptor.