Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6940

Using subscript operator on untyped model item fails compilation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.4
    • 2.3.5
    • Templating
    • None

    Description

      Using the markup template engine and an untyped "list" variable like the following, the template compilation fails:

            MarkupTemplateEngine engine = new MarkupTemplateEngine(new TemplateConfiguration())
      
              def template = engine.createTemplate '''
                  yield list[0]
              '''
              def model = [list:['Item 1']]
              String rendered = template.make(model)
              assert rendered == 'Item 1'
      

      Error is:

      BUG! exception in phase 'class generation' in source unit 'GeneratedMarkupTemplate0' At line 2 column 19
      On receiver: this.getModel().get(list) with message: getAt and arguments: 0
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: