Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GROOVY-9999,GROOVY-8488:STC:make decimal literal parameter can auto c… #1602

Closed
wants to merge 1 commit into from

Conversation

YueZhikong
Copy link

fix GROOVY-9999,GROOVY-8488, in general, make literal such as "4.0" could be use in double param method such as "Math.sqrt(double a)".

@eric-milles
Copy link
Member

For STC, there are a couple methods that check the compatibility of arguments and parameters or source and target types. I would expect a change in one of these to allow BigDecimal as argument to double parameter. I'm not sure of the reason for the change to make BigDecimal not convert as before. It would be good to understand why this stopped working at some point.

In terms of tests, we are slowly migrating away from GroovyTestCase and GroovyShell#evaluate in favor of JUnit 4 and GroovyAssert#assertScript. It appears you have taken us in the reverse direction.

@YueZhikong
Copy link
Author

For STC, there are a couple methods that check the compatibility of arguments and parameters or source and target types. I would expect a change in one of these to allow BigDecimal as argument to double parameter. I'm not sure of the reason for the change to make BigDecimal not convert as before. It would be good to understand why this stopped working at some point.

In terms of tests, we are slowly migrating away from GroovyTestCase and GroovyShell#evaluate in favor of JUnit 4 and GroovyAssert#assertScript. It appears you have taken us in the reverse direction.

@eric-milles
Is the method "StaticTypeCheckingVisitor#findMethod" designed to "check the compatibility of arguments and parameters or source and target types"?

That method returns empty mn in "StaticTypeCheckingVistor:3479",and causes "GROOVY-9999","GROOVY-8488". And my idea is to write a new method "StaticTypeCheckingVisitor#bigDecimalCast" to “check the compatibility”。 Maybe I should integrate the logic of "bigDecimalCast" into "findMethod"?

And could you tell me all "methods that check the compatibility of arguments and parameters or source and target types"? That may help to solve GROOVY-8168 which is possible caused by similar method like "StaticTypeCheckingVisitorfindMethod".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants