[
https://issues.apache.org/jira/browse/GROOVY-12535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18139585#comment-18139585
]
ASF GitHub Bot commented on GROOVY-12535:
-----------------------------------------
testlens-app[bot] commented on PR #3154:
URL: https://github.com/apache/groovy/pull/3154#issuecomment-6684089841
## 🚨 TestLens detected 2 failed tests 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3154`
#### [Build and test / lts \(17, windows-latest,
1\)](https://github.com/apache/groovy/actions/runs/42209096465/job/127863016814?pr=3154)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| ParserNegativeSyntaxTest > closed paren groups before a later syntax error
are not missing parens\(\) | ❌ | 0% 🟢 |
| ParserNegativeSyntaxTest > type pattern in case label after a record
declaration\(\) | ❌ | 0% 🟢 |
🏷️ Commit: 12ef9e0c320a307c3eb4b5080cb1faae7ab95174
▶️ Tests: 73085 executed
🟡 Checks: 8/25 completed
### Test Failures
<details><summary><strong>ParserNegativeSyntaxTest > closed paren groups
before a later syntax error are not missing parens()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42209096465/job/127863016814?pr=3154">Build
and test / lts (17, windows-latest, 1)</a>)</summary>
```
org.opentest4j.AssertionFailedError: expected parse to fail
at org.junit.jupiter.api.Assertions.fail(Assertions.java:142)
at
org.apache.groovy.parser.antlr4.TestUtils.compileMessage(TestUtils.groovy:130)
at
org.apache.groovy.parser.antlr4.TestUtils.expectParseError(TestUtils.groovy:190)
at org.apache.groovy.parser.antlr4.ParserNegativeSyntaxTest.closed
paren groups before a later syntax error are not missing
parens(ParserNegativeSyntaxTest.groovy:3945)
```
</details>
<details><summary><strong>ParserNegativeSyntaxTest > type pattern in case
label after a record declaration()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42209096465/job/127863016814?pr=3154">Build
and test / lts (17, windows-latest, 1)</a>)</summary>
```
org.opentest4j.AssertionFailedError: expected parse to fail
at org.junit.jupiter.api.Assertions.fail(Assertions.java:142)
at
org.apache.groovy.parser.antlr4.TestUtils.compileMessage(TestUtils.groovy:130)
at
org.apache.groovy.parser.antlr4.TestUtils.expectParseError(TestUtils.groovy:190)
at org.apache.groovy.parser.antlr4.ParserNegativeSyntaxTest.type
pattern in case label after a record
declaration(ParserNegativeSyntaxTest.groovy:3927)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 ParserNegativeSyntaxTest > closed paren groups before a later syntax error
are not missing parens\(\) <!
> STC: property-style assignment to a Map<String,String> accepts a GString
> value and stores it unconverted
> --------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12535
> URL: https://issues.apache.org/jira/browse/GROOVY-12535
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Assignee: Daniel Sun
> Priority: Major
> Fix For: 7.0.0-alpha-1, 6.0.1
>
>
> Under static type checking, a {{GString}} can't be put into a
> {{Map<String,String>}} through {{put}} or the subscript operator; both are
> rejected. Assigning through property notation is accepted, though, and the
> {{GString}} is stored as is:
> {code:groovy}
> @groovy.transform.CompileStatic
> def go() {
> def n = 'ab'
> Map<String,String> m = [:]
> m.k = "$n"
> ((Map) m).values()*.getClass()*.simpleName
> }
> assert go() == ['GStringImpl'] // expected ['String']
> {code}
> ||Form||Result (4.0.29, 6.0.0, master)||
> |{{m.k = "$n"}}|compiles, stores a {{GStringImpl}}|
> |m.with { k = "$n" }|compiles, stores a {{GStringImpl}}|
> |{{m['k'] = "$n"}}|STC error: Cannot call ... putAt ...|
> |{{m.put('k', "$n")}}|STC error: Cannot call ... put(String, String) ...|
> Statically compiled code can't otherwise add a {{GString}} to a collection
> typed for Strings ({{<<}}, {{add}}, {{set}}, {{addAll}}, {{+=}}, {{putAt}}
> and {{put}} are all rejected), so this is the one hole on the write side.
> Later reads that expect a {{String}} can then fail. For example, Java code
> doing {{String s = m.get('k')}} throws {{ClassCastException}}, and
> {{m.get('k').equals('ab')}} is false.
> Expected: either convert the value to a {{String}} at the assignment, as
> Groovy does for {{String s = "$n"}}, or report the same error as {{put}} and
> {{putAt}}. Converting matches the general rule that a {{GString}} becomes a
> {{String}} where one is required, and wouldn't break existing code that
> compiles today.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)