Repository navigation
Fix the package no longer compiling to JavaScript (a 3.5.18 regression) - #475
Merged
Merged
Conversation
The `infinity` sentinels for `timestamp` were written as 64-bit integer
literals. JavaScript cannot represent them exactly, so dart2js rejects
any program that imports the package:
Error: The integer literal 9223372036854775807 can't be represented
exactly in JavaScript.
Build them from their 32-bit halves instead. The values are unchanged on
the VM.
The driver does not run in a browser, but apps that share code between
a server and a web client compile it there. A test now compiles the
public libraries with dart2js.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 3.5.18, any program that imports
package:postgresfails to compile with dart2js:The driver does not run in a browser. But we share code between a server and a Flutter web client, and that code imports this package for its types and exceptions. So the web build has to compile it, and 3.5.17 did.
The fix
The sentinels are now built from their 32-bit halves, so no literal is out of range:
On the VM the values are unchanged: the int64 maximum and minimum. The existing infinity decode tests in
encoding_test.dartstill pass.The test
test/js_compile_test.dartcompiles both public libraries withdart compile js. It fails on master with the error above and passes with this change. It needs no database.