[ 
https://issues.apache.org/jira/browse/GROOVY-12754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18141685#comment-18141685
 ] 

ASF GitHub Bot commented on GROOVY-12754:
-----------------------------------------

testlens-app[bot] commented on PR #3285:
URL: https://github.com/apache/groovy/pull/3285#issuecomment-6756191274

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3285`
   
   #### [Build and test / lts \(17, 
macos-latest\)](https://github.com/apache/groovy/actions/runs/42732794694/job/129554704756?pr=3285)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | StaticCompileRuntimePackageTest > testSystemProperty\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: 07a0fa53fb63c3b7bc3e760a5744624d9fa9d67e
   ▶️ Tests:  75219 executed
   🟡 Checks: 8/24 completed
   
   ### Test Failures
   
   <details><summary><strong>StaticCompileRuntimePackageTest > 
testSystemProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/42732794694/job/129554704756?pr=3285";>Build
 and test / lts (17, macos-latest)</a>)</summary>
   
   ```
   Assertion failed: 
   
   assert 
config.optimizationOptions[CompilerConfiguration.RUNTIME_PACKAGE_CHECK] == 
Boolean.FALSE
          |      |                  |                      |                    
  |          |
          |      |                  null                   
'runtimePackageCheck'  false      false
          |      ['indy':true, 'parallelParse':true]
          org.codehaus.groovy.control.CompilerConfiguration@5dd227b7
   
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:407)
        at 
org.codehaus.groovy.classgen.asm.sc.StaticCompileRuntimePackageTest.testSystemProperty(StaticCompileRuntimePackageTest.groovy:468)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 StaticCompileRuntimePackageTest > testSystemProperty\(\) <!

> STC: an upper-bounded wildcard argument is checked against a type parameter's 
> bound the wrong way round
> -------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12754
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12754
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> Static type checking rejects a call that passes an upper-bounded wildcard, 
> such as {{List<? extends Integer>}}, to a generic method whose type parameter 
> is bounded by a supertype of the wildcard's bound. It accepts the call when 
> the wildcard's bound is wider than the type parameter's. javac does the 
> opposite in both cases.
> {code:groovy}
> @groovy.transform.CompileStatic
> class C {
>     static <T extends Number> T first(List<T> list) { list.get(0) }
>     static <T extends CharSequence> int len(Class<T> type) { 0 }
>     static <T extends Integer> T narrow(List<T> list) { list.get(0) }
>     static Object a(List<? extends Integer> ints) { first(ints) }  // 
> rejected, javac accepts
>     static int b(Class<? extends String> type) { len(type) }       // 
> rejected, javac accepts
>     static Object c(List<? extends Number> nums) { narrow(nums) }  // 
> accepted, javac rejects
> }
> {code}
> {noformat}
> [Static type checking] - Cannot call <T extends java.lang.Number> 
> C#first(java.util.List<T>) with arguments [java.util.List<? extends 
> java.lang.Integer>]
> [Static type checking] - Cannot call <T extends java.lang.CharSequence> 
> C#len(java.lang.Class<T>) with arguments [java.lang.Class<? extends 
> java.lang.String>]
> {noformat}
> The capture of {{? extends B}} is a subtype of {{B}} (JLS 5.1.10), so it is 
> within the bound of {{T}} exactly when {{B}} is. javac reports "inference 
> variable T has incompatible bounds" for {{c}}. Groovy compiles {{c}}, and 
> {{c([1.5d])}} returns {{1}}.
> {{StaticTypeCheckingSupport#compatibleConnection}} tests a wildcard witness 
> with {{connection.isCompatibleWith(bound)}}, which asks whether the type 
> parameter's bound fits within {{? extends B}}. For a type argument {{B}}, it 
> tests {{? super B}} against the bound. An upper-bounded wildcard should take 
> the same test.
> PR: https://github.com/apache/groovy/pull/3285



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to