Skip to content

Errors relating to math module #2845

Description

@swamishiju

Currently the integration test for the math module doesn't work I have compiled a list of issues that cause this

  • Kwargs are not supported in general (in is_close specifically)
  • Functions returning non trivial data types (modf, frexp) which are then assigned to a variable

Another error i found while testing is

  • Functions returning non trivial data types which are not assigned to anything or passed into functions

Simplest replication code for each

def f(x: i32 = 0):
    print(x)
def f() -> list[i32]:
    return [1,2]

x: list[i32]
x = f()
def f() -> list[i32]:
    return [1,2]

f()

The only cases in which function returning lists and tuple are not a headache is when we use it as input to some function

Activity

  1. amritamishra01 commented on Dec 11, 2025

    @amritamishra01

    Hi @swamishiju,

    I'd like to work on this issue if it's still open.
    From your description, the problems seem related to handling non-trivial return types and kwargs in semantic analysis and lowering, which fits well with the areas I've been contributing to.

    Please let me know if I can proceed.

    Thanks!

  2. swamishiju commented on Dec 11, 2025

    @swamishiju
    CollaboratorAuthor

    I was working on good test coverage for non-trivial types in the Fortran backend (which has more tests, and will let us know if it something broke earlier). I didn’t finish during GSoC, but I did get lists and tuples working to a good degree — not sure if that’s enough to fix this case. If you can find simple fixes that would be great, but it’s possible the full resolution will still need backend changes.

    However I think the equivalent code in fortran compiles properly, so maybe just modifying ASR could do the trick.
    Relevant work report: https://swamishiju.github.io/final.html

    Edit: I just checked i think the second code works now, third one is still giving an error, I fixed the math module - the third block I think is just a general issue. We could I think give an unused value warning, Fortran I think just gives a vague error statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions