<commit_before>// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion This new syntax also introduces new ambiguities in the grammar,
/// similar to the one we introduced with generic functions. Examples include:
///
/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
/// f(x.a<b,c>-d);  // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
/// an explicitly instantiated type literal named using a prefix, which is new.
/// While neither type objects nor functions declare operator- or operator[],
/// such could be added using extension methods.
///
/// We will disambiguate such situations heuristically based on the token
/// following the >. In the existing ambiguity we treat ( as a sign that it's a
/// generic invocation. If the next character is one which cannot start a new
/// expression (and thereby be the second operand of a > operator), the prior
/// tokens is parsed as an explicit instantiation. If the token can start a new
/// expression, then we make a choice depending on what we consider the most
/// likely intention (that's specifically - and [ in the examples above).
///
/// The look-ahead tokens which force the prior tokens to be type arguments are:
///
/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
///
/// & | ^ + * %  / ~/
///
// Any other token following the ambiguous > will make the prior tokens be
// parsed as comma separated < and > operator invocations.
///
/// @description Checks disambiguate by '?..' token. Test that a<b, c>?.. is
/// parsed as (a<b), (c>?..)
/// @author <EMAIL>

// SharedOptions=--enable-experiment=constructor-tearoffs

void f(x, [y]) {}

main() {
  int a = 1;
  int b = 2;
  int c = 3;
  f(a<b,
      c>?..toString());
//      ^^^<commit_msg>Issue number added<commit_after>// Copyright (c) 2021, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion This new syntax also introduces new ambiguities in the grammar,
/// similar to the one we introduced with generic functions. Examples include:
///
/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
/// f(x.a<b,c>-d);  // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
/// an explicitly instantiated type literal named using a prefix, which is new.
/// While neither type objects nor functions declare operator- or operator[],
/// such could be added using extension methods.
///
/// We will disambiguate such situations heuristically based on the token
/// following the >. In the existing ambiguity we treat ( as a sign that it's a
/// generic invocation. If the next character is one which cannot start a new
/// expression (and thereby be the second operand of a > operator), the prior
/// tokens is parsed as an explicit instantiation. If the token can start a new
/// expression, then we make a choice depending on what we consider the most
/// likely intention (that's specifically - and [ in the examples above).
///
/// The look-ahead tokens which force the prior tokens to be type arguments are:
///
/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
///
/// & | ^ + * %  / ~/
///
// Any other token following the ambiguous > will make the prior tokens be
// parsed as comma separated < and > operator invocations.
///
/// @description Checks disambiguate by '?..' token. Test that a<b, c>?.. is
/// parsed as (a<b), (c>?..)
/// @author <EMAIL>
/// @issue 47060

// SharedOptions=--enable-experiment=constructor-tearoffs

void f(x, [y]) {}

main() {
  int a = 1;
  int b = 2;
  int c = 3;
  f(a<b,
      c>?..toString());
//      ^^^
{'fraction_non_alphanumeric': 0.15669099756690996, 'fraction_numerical': 0.004622871046228711, 'mean_word_length': 2.8170844939647166, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5526437', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1218, 'n_words': 552}