Skip to content

Throwing a descriptive error upon encountering inline function #1030

Closed

Description

@diastremskii

Inline functions are not supported as mentioned in README and here. Currently, when mocking behaviour of the inline function, the body of the function ("real" implementation) starts to execute, leading to errors that are difficult to debug and pinpoint to mockk (or the function itself being inline). It would be great to have a fail-fast approach, where Mockk would fail right away with an error when trying to mock an inline function.

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected Behavior

Encountering a meaningful error describing that mocking inline functions isn't supported.

Current Behavior

When mocking, code of the inline function (actual one, not the mocked one) starts to execute with unpredictable and hard-to-debug consequences.

Activity

  1. ch200203 commented on Aug 7, 2025

    @ch200203
    Contributor

    Hi 👋 Can I take a look at this issue? :)
    It's a bit old, but I was wondering if this issue has been resolved? If not, I would like to contribute to fixing it

  2. Raibaz commented on Aug 7, 2025

    @Raibaz
    Collaborator

    Sure, go ahead, thanks!

  3. ch200203 commented on Aug 8, 2025

    @ch200203
    Contributor

    Thanks! 🙌
    I’ll work on this and try to open a PR within this week for your review.

  4. ch200203 commented on Aug 11, 2025

    @ch200203
    Contributor

    I’ve submitted a PR for this issue.
    Would appreciate it if you could review it when possible. Thanks! 🙏

  5. tulsishuka commented on Aug 11, 2025

    @tulsishuka

    sir can work on it if pr is not merge

  6. injae-kim commented on Aug 11, 2025

    @injae-kim

    Fix PR: #1421 PTAL~ 👍

  7. added a commit that references this issue on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions