Skip to content

Commit e081615

Browse files
authored
Fix formatting bug with map key expression (#6893)
1 parent 4bd7e4f commit e081615

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

modules/nf-lang/src/main/java/nextflow/script/control/ResolveVisitor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ protected Expression transformPropertyExpression(PropertyExpression pe) {
360360
property = transform(pe.getProperty());
361361
var result = new PropertyExpression(objectExpression, property, pe.isSafe());
362362
result.setSpreadSafe(pe.isSpreadSafe());
363+
result.copyNodeMetaData(pe);
363364
// attempt to resolve property expression as a fully-qualified class name
364365
var className = lookupClassName(result);
365366
if( className != null ) {

modules/nf-lang/src/test/groovy/nextflow/script/formatter/ScriptFormatterTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,14 @@ class ScriptFormatterTest extends Specification {
620620
[(x): 1]
621621
'''
622622
)
623+
checkFormat(
624+
'''\
625+
[(x.y):1]
626+
''',
627+
'''\
628+
[(x.y): 1]
629+
'''
630+
)
623631
}
624632

625633
def 'should format a closure' () {

0 commit comments

Comments
 (0)