Type inference logging may be used to examine details of the
analyzer's type inference algorithm. It may be invoked as follows:
dart pkg/analyzer/tool/type_inference_log.dart <file_to_analyze>
The log is printed to standard output.
Change-Id: I687e4a343e2ea11c6a757066c4375fd6a411e1af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This saves us about 150 ms, from 2350 ms.
In a macro running benchmark with 200 JSON classes in 20 libraries.
Bug: https://github.com/dart-lang/sdk/issues/55784
Change-Id: Ia2e242b38157709cd34fafc9445159676824f3d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372800
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The single loader does the same thing here:
ef59500e6f/sdk/lib/_internal/js_runtime/lib/js_helper.dart (L3257)
This retry token acts as a cache-buster for requests where the download succeeded but the part file was corrupted and failed to initialize. In that case Chrome has to re-download the file, it can't use the cached file.
I just missed passing this parameter when I added the new multiloader.
b/348644880
Change-Id: I26f4bc0da6c7e6fd714f442df8d32b8f10678047
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372700
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Auto-Submit: Nate Biggs <natebiggs@google.com>
This CL adds `isWildcard` to `StructuralVariableBuilder` and allows type variables in functions and function types. It also removes them from scope so they can't be used.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I26237375480318dd0c9a01cb59b3426b783ca7be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Also, add an assertion to `SharedInferenceLogWriter` to prevent
accidentally setting static types more than once in the future.
Change-Id: If96a40c5490d91b67e061158b2b92af90c05d4d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372602
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The type inference logging infrastructure in the analyzer is built out
to include the following functionality:
- Tracking of type inference of annotations, collection elements,
patterns, and statements.
- Tracking of method lookups.
- Tracking of the generic type inference process, including type
formals, constraints that were generated (and their sources),
partial solutions, and the final types chosen.
It is not yet possible to invoke this functionality on the command
line; I plan to introduce a mechanism for doing so in a follow-up
commit.
Change-Id: I3f592a483b272fcea74c1e31bc51f2c5c3623bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This removes the special runtime blob for string conversions, instead we
make 2 functions for conversions use our built-in `JS<>()` support.
This will allow specializing the implementation in a future CL.
Change-Id: I06df25ed805042c0a3e2efb966eaebd1ce67dc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372660
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
The intent of the new method is that it can be used to get the candidate
suggestions before they are sent to the suggestion builder, making it
easier for us to skip the suggestion builder (in the future) and
translate directly into the apporpriate protocol objects.
Change-Id: I4cb185f9076e559dd131870f9c3f05bc4fc883f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372601
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This WasmArray-backed list classes to `dart:_list`, similar to
`dart:_string` and `dart:_typed_data`
This will allow having internally-public list members like unchecked
getters and setters that we will use in the rest of the standard
library.
This CL doesn't add anything new, just renames things.
- `dart.core._ListBase` -> `dart._list.WasmListBase`
This is to avoid confusion with `dart.core.ListBase` (defined by Dart
standard library), and also to be consistent with `WasmTypedDataBase`
and `WasmStringBase`.
- `dart.core._List` -> `dart._list.ModifiableFixedLengthList`
Similar to the above, to avoid confusion with `dart.core.List`.
- `GrowableList.ofOther` -> `GrowableList.fromIterable`
`ofOther` sounds like it should make a growable list from another
growable list, but the type is more general than that. To reflect what
it actually does we call it `fromIterable`.
Tested: Existing tests.
Change-Id: I24398765e1b0d549fc70b03ba94161479c5fc54c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372622
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
The presubmit has a different working dir than expected, making the
check not work (which has resulted in some status entries that shouldn't
have existed).
This CL sets the working directory for the presubmit making the check
work.
Change-Id: I7535050c73af6cd5ae7957c63c85fb2c3b33813d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372624
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
After 9a9b33eb0b running the outline suite
got noticeably slower.
For whatever reason it wasn't noticed until now though.
```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/outline_suite.dart --traceStepTiming
[...]
[ 05:02 | 100.0% | + 2914 | - 0 ]: outline/wildcard_variables/unnamed_optional_parameter_no_default
check errors: 0:00:00.301055 ms
ErrorCommentChecker: 0:00:00.455464 ms
stress constant evaluator: 0:00:00.810962 ms
write .dill: 0:00:01.040020 ms
print: 0:00:01.048330 ms
verify: 0:00:06.864096 ms
match expectations: 0:00:07.527595 ms
typeCheck: 0:00:12.512297 ms
outline: 0:04:31.713300 ms
```
The reason is that the outline also serializes the entire component (including the platform).
This CL disables that and instead gets (back) to:
With this CL:
```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/outline_suite.dart --traceStepTiming
[...]
[ 01:15 | 100.0% | + 2914 | - 0 ]: outline/wildcard_variables/unnamed_optional_parameter_no_default
check errors: 0:00:00.347309 ms
ErrorCommentChecker: 0:00:00.438746 ms
stress constant evaluator: 0:00:00.915786 ms
write .dill: 0:00:01.092630 ms
print: 0:00:01.108090 ms
verify: 0:00:07.156487 ms
match expectations: 0:00:08.019510 ms
typeCheck: 0:00:14.013395 ms
outline: 0:00:41.738619 ms
```
Change-Id: I1fd7486384b34a54ec86b884f102eae6963508f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372483
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Golem config expects RunTimeRaw metric (as we want to see not runs per
second but a more meaningful benchmark, i.e. how much transferring 1KB
of data takes)
=> Golem cannot just display it in different form, we have to make the
benchmark report it also as RunTimeRaw.
=> This CL should fix the golem benchmarks.
Change-Id: I91301930941986771eb0725fd0d85424bb07dc3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372640
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This reverts commit 282893db9e.
Reason for revert: breaks roll of flutter into google3.
Original change's description:
> [cfe] Process invocations eagerly
>
> Some invocation nodes, such as redirecting factory invocations,
> type-aliased constructor invocations, and type aliased factory
> invocations, were unaliased and resolved via lists of delayed
> processing actions. That was due to dependencies of the processing
> actions on each other.
>
> This CL untangles the dependencies and processes the invocations
> eagerly. Namely, the redirecting factory constructors are processed
> before all other nodes that may require unaliasing and resolving. The
> eager processing of nodes eliminates the need for fragile filtering of
> the nodes that may require post-processing.
>
> Change-Id: I3e6971515a974c01eced31aa68bf72399dcfa8b8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372280
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Change-Id: Ib2a9da524a763396559e48aec70f2581e85ebdd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372620
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This change makes the following improvements:
- The setter for `nameNode.staticElement` is always
invoked. Previously it was only invoked when storing a non-null
element. In principle this shouldn't make a difference (since static
elements default to `null`), but it should hopefully make the code a
little easier to reason about.
- In the case where the `receiverType` is `InvalidType`, no other
resolution is attempted. Previously, in this case, an attempt was
still made to resolve the method invocation to a member of `Object`,
which kind of went against the intended behavior of
`InvalidType`. Also, if a matching member of `Object` _was_ found,
then `nameNode.staticType` would get set more than once, making it
more difficult for the reader to understand what the code was doing.
- In the case where the method invocation resolves to a method of
`Object`, `nameNode.staticType` and `node.staticInvokeType` are set
to the type of that method. Previously they were not set at all in
this case (but they were set in all other cases).
In addition the logic is more straightforward, since the various AST
properties are always set in the same order by straightforward inline
code.
Change-Id: I246a2e9c53542b1e4b26d5197708e66e7988789d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Since sound null safety, 'vm:non-nullable-result-type' pragma is
no longer useful as the same information is conveyed by a non-nullable
return type.
TEST=ci
Change-Id: Ie6a61aca38cfea47cb005b12ca7f0d7631791024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372200
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
* Fix `ToWinAPIFilePath` handling of UNC paths. This function did
not handle UNC paths correctly: it was prefixing them with
`\\?\` instead of `\\?\UNC\`;
* Fix issue in `File::Copy` forcing the wrong path to long form:
temporary files are created next to the destination, so it
is destination (`new_path`) that should be forced into long form and
not the source;
* Fix issue in `GetDirectoryPath` not preserving the path separator.
The newly added test should cover all these corner cases to prevent
future regressions.
TEST=standalone/io/regress_56049
Fixes https://github.com/dart-lang/sdk/issues/56049
Fixed: 56049
Change-Id: I4970efd0674989b8cc291778cf87806b0ea318ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372400
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Wildcard type parameters are not added to the scope of the class. They do not collide with other wildcards or other wildcard type parameters.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I473a5023c570623fe2a11df5c07d491082bab642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371943
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
On the bots, the system temp directory has a lowercase drive letter (`c:\`) but the analyzer normalises the path to uppercase. The output for the error being used in the test contains a complete path so this allows for casing differences.
Fixes https://github.com/dart-lang/sdk/issues/56059
Change-Id: Id85fba7965a64a83783e7eb8e180cac0a5df9a1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
See the comments before tests for details.
The test cases are generated with this Rust program:
```
use num::*;
fn main() {
// 10111...., 65 bits
let lo: u64 = (1 << 63) - 1;
let mut err_pattern: BigUint = BigUint::from(lo);
err_pattern.set_bit(64, true);
// In the error case, the bit after the sign bit should be set (this bit will be lost), and
// sign bit should be unset (so that overflow won't make the result negative).
assert!(err_pattern.bit(64));
assert!(!err_pattern.bit(63));
// For each radix, find the number and digit where
// `<error> = (<old number> * <radix>) + <digit>`.
'radix_loop: for radix in 4..=36u32 {
for digit in 0..radix {
let i: BigUint = (err_pattern.clone() - BigUint::from(digit)) / BigUint::from(radix);
if !i.bit(64) && !i.bit(63) {
println!(
"{}: {} + {} ({} + {})",
radix,
i.to_str_radix(radix),
BigUint::from(digit).to_str_radix(radix),
i,
digit,
);
continue 'radix_loop;
}
}
}
}
```
Change-Id: I6fe92c46b31373f465702744ee069394db949b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372422
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
This test file tested the old `onError` parameter of `int.parse` and was
removed in b3304af17d.
Also remove strange code from pre-null-safe days.
Change-Id: I224b4c4002c14050b67c29c7327e31b422b18ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372420
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Revisions updated by `dart tools/rev_sdk_deps.dart`.
dartdoc (818d1f5..6330a13):
6330a13e 2024-06-18 Sam Rawlins Declare local variables for the 'href' field, to promote and avoid printing 'null' (dart-lang/dartdoc#3788)
822ca007 2024-06-18 Sam Rawlins Stop supporting '[this]' as a comment reference. (dart-lang/dartdoc#3765)
ecosystem (8ada2ee..31148cd):
31148cd 2024-06-20 Devon Carew cosmetic update to the triager's comment format (dart-lang/ecosystem#273)
glob (eaec6a4..6d3ba5e):
6d3ba5e 2024-06-20 Kevin Moore update lints (dart-lang/glob#95)
logging (dbd6829..240ec33):
240ec33 2024-06-20 Kevin Moore Update lints dep, bump min SDK (dart-lang/logging#167)
Change-Id: I2a691c3a4d02f55a625afaa855ab3e5aa60259c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372520
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
CoreLibraryReviewExempt: Trivial change.
Change-Id: I5c23641ed562efe51c0c7c35517ba75fffdd05ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372503
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This CL fixes symlink resolution by properly decoding a URI to a file
path before doing symlink resolution (on the file path).
File paths have spaces, but URIs can be encoded with percent encoding.
Before resolving the relative paths, the symlink-resolved script path
is encoded as URI again. This encoding is trivial (percentage
encoding is optional), so it only needs to prepend a scheme.
Also, this CL improves the error message for the relative path
resolution if the dylib cannot be found to include the script uri.
TEST=tests/ffi/native_assets/asset_relative_test.dart
Closes: https://github.com/dart-lang/sdk/issues/56053
Change-Id: I3ac9748e971e6eacbe14f3485bf3a3943d587d7d
Cq-Include-Trybots: dart/try:vm-aot-asan-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-msan-linux-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-optimization-level-linux-release-x64-try,vm-aot-tsan-linux-release-x64-try,vm-aot-ubsan-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64-try,vm-aot-win-debug-x64c-try,vm-asan-linux-release-arm64-try,vm-msan-linux-release-arm64-try,vm-tsan-linux-release-arm64-try,vm-ubsan-linux-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372421
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Add new string extensions with unchecked `codeUnitAt` and `substring`
methods.
Replace old unchecked functions `oneByteStringCodeUnitAtUnchecked` and
others with the extension methods.
Most of the CL replaces old functions with extensions. New uses are only
introduced in `dart:convert`.
Change-Id: I44151bbc65c0bf4467d88911f8a088bbe1910eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372443
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
This moves `JSStringImpl` class from `dart:_js_types` to `dart:_string`.
This allows implementing a common base class with unchecked operations
to all string classes as internal methods (so users won't be able to
call them via `dyanmic`), and extension methods to call these unchecked
methods in libraries like `dart:convert`.
Uses of these methods are introduced in
https://dart-review.googlesource.com/c/sdk/+/372443.
Change-Id: Ie4cfe778654c42d62bc4a90391fe349fa783a42c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372442
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
The https://dart-review.googlesource.com/c/sdk/+/371100
should have included this change, but I somehow managed
to not include it in the upload.
CoreLibraryReviewExempt: Would have been part of accepted CL
Change-Id: Ia9d133ef753413d4804d04db2478e73709e5e5ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372440
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Currently code uses `double` to represent array indices, array lengths
etc. This seems wrong because `double`s can loose precision. This is
also a high overhead.
Understandably one could use `double` and only start to loose precision
with more than 32 bits, but realistically string lenghts, array lengths
cannot exceed 31-bits (i.e. 2 GBs) in practice.
=> Use Wasmi32 to represent array indices, array lengths, bytes loaded
from integer arrays, ...
Change-Id: Ife540622c85118d890a8e487677db56e2ce06f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372424
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Adds an interface which implements both `TypedData`
and `List`. That allows abstracting over types that are both
`List` and `TypedData` without losing access to one of the
interfaces.
Tested: typed_data_interface_test.dart
Change-Id: Idbdfc084ea5d2d9a072887973e2e9d29a5fd94ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Some invocation nodes, such as redirecting factory invocations,
type-aliased constructor invocations, and type aliased factory
invocations, were unaliased and resolved via lists of delayed
processing actions. That was due to dependencies of the processing
actions on each other.
This CL untangles the dependencies and processes the invocations
eagerly. Namely, the redirecting factory constructors are processed
before all other nodes that may require unaliasing and resolving. The
eager processing of nodes eliminates the need for fragile filtering of
the nodes that may require post-processing.
Change-Id: I3e6971515a974c01eced31aa68bf72399dcfa8b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>