You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2022/09/17 07:45:50 UTC
[groovy] branch master updated: Add a test for "GROOVY-9999: @TypeChecked results in Error when groovy casts to BigDecimal ([Static type checking] - Cannot find matching method java.lang.Math#sqrt(java.math.BigDecimal))"
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new b62dec0d18 Add a test for "GROOVY-9999: @TypeChecked results in Error when groovy casts to BigDecimal ([Static type checking] - Cannot find matching method java.lang.Math#sqrt(java.math.BigDecimal))"
b62dec0d18 is described below
commit b62dec0d1828390eb39a7154874c17a70e5c7e93
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Sep 17 15:45:13 2022 +0800
Add a test for "GROOVY-9999: @TypeChecked results in Error when groovy casts to BigDecimal ([Static type checking] - Cannot find matching method java.lang.Math#sqrt(java.math.BigDecimal))"
---
src/test/groovy/transform/stc/BugsSTCTest.groovy | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/test/groovy/transform/stc/BugsSTCTest.groovy b/src/test/groovy/transform/stc/BugsSTCTest.groovy
index e3738a6d2c..10d40486bb 100644
--- a/src/test/groovy/transform/stc/BugsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/BugsSTCTest.groovy
@@ -1177,4 +1177,19 @@ Printer
new Outer().test()
'''
}
+
+ // GROOVY-9999
+ void testMathSqrt() {
+ assertScript '''
+ import groovy.transform.TypeChecked
+
+ @TypeChecked
+ def test() {
+ Math.sqrt(Math.PI*2)
+ }
+
+ double result = (double) test() // 2.5066282746310002
+ assert result > 2.5066
+ '''
+ }
}