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

Overload resolution ambiguity for goTo function #6

Closed
wakaztahir opened this issue May 24, 2023 · 2 comments
Closed

Overload resolution ambiguity for goTo function #6

wakaztahir opened this issue May 24, 2023 · 2 comments

Comments

@wakaztahir
Copy link

wakaztahir commented May 24, 2023

Overload resolution ambiguity. All these functions match. in IDE:

public fun <Destination : NavigationDestination /* = Any */, Context : NavigationContext<TypeVariable(Destination)>> Navigator<TypeVariable(Destination), TypeVariable(Context)>.goTo(destination: TypeVariable(Destination)): Boolean defined in com.chrynan.navigation
public fun <Destination : Any, Context : NavigationContext<TypeVariable(Destination)>> Navigator<TypeVariable(Destination), TypeVariable(Context)>.goTo(destination: TypeVariable(Destination)): Unit defined in com.chrynan.navigation

also to use dispatch , the constructors for Forward Event or Backward Event Destination are internal or private , so dispatch can't be used

@wakaztahir
Copy link
Author

Actually I was using fork now that I've replaced it with original dep , its causing issue , investigating further

@chRyNaN
Copy link
Owner

chRyNaN commented May 26, 2023

A couple points of note here:

  • There are two NavigationDestination functions: one for a context and destination and the other for a SingleNavigationContext and a destination. To let the compiler know which one to use, explicitly specify the parameter names.
NavigationDestination(...) { destination -> ... }
// Or
NavigationDestination(...) { context, destination -> ... }
  • The dispatch function is not meant to be invoked from outside of the library's internal code. That is why the NavigationEvent constructors are internal. Instead, use the appropriate go* function (ex: goBack, goTo, or changeContext).

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

No branches or pull requests

2 participants