Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-433

Better handling of placeholder

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8
    • Component/s: Go, Rules
    • Labels:
      None

      Description

      To solve FP in Scala (SONARSLANG-350), we decided to add the support for placeholder (wildcard, "_", ...).

      This make sense since multiple language contains this feature.

       

      However, Placeholder inherits from Tree, we can not use it where an IdentifierTree is expected.

      This causes problem to parse the following SLang code:

      A._ = "xxx";
      

      Or the GO examples:

      var _ int = 1 // VariableDeclarationTree
      fun(_ int) { //... } // ParameterTree
      

      To correctly map this code, we need to create a ParameterTree and VariableDeclaration, with placeholder as identifier.

      This is currently not possible because both requires IdentifierTree as identifier (and therefore not a PlaceholderTree).

       

      When modifying placeholder, we have to make sure impacted rules and syntactic equivalence correctly support it.

        Attachments

          Activity

            People

            Assignee:
            amelie.renard Amélie Renard
            Reporter:
            quentin.jaquier Quentin Jaquier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: