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

Add two new type constructors: MethodReturnType and StaticMethodReturnType #7745

Closed
magnus-madsen opened this issue May 20, 2024 · 0 comments · Fixed by #7748
Closed

Add two new type constructors: MethodReturnType and StaticMethodReturnType #7745

magnus-madsen opened this issue May 20, 2024 · 0 comments · Fixed by #7748

Comments

@magnus-madsen
Copy link
Member

After Native add:

  /**
    * A type constructor that represents the _return type_ of a Java method.
    *
    * A method return type can be resolved when the receiver object and argument types are known.
    *
    * A few examples:
    *
    * - The type: `Apply(InvokeMethod("length", 0), String)` is equivalent to `Int32`.
    * - The type: `Apply(Apply(InvokeMethod("startsWith", 1), String), String)` is equivalent to `Bool`.
    * - The type: `Apply(Apply(Apply(InvokeMethod("substring", 2), String), Int32), Int32)` is equivalent to `String`.
    *
    * The type constructor requires at least one type argument: the type of the receiver object.
    */
  case class MethodReturnType(name: String, arity: Int) extends TypeConstructor {
    def kind: Kind = Kind.mkArrow(arity + 1)
  } 

  /**
    * A type constructor that represents the _return type_ of a Java static method.
    *
    * A static method return type can be resolved when the argument types are known.
    *
    * A few examples:
    *
    * - The type: `Apply(InvokeStaticMethod(String.class, "valueOf", 1), Bool)` is equivalent to `String`.
    * - The type: `Apply(InvokeStaticMethod(String.class, "valueOf", 1), Char)` is equivalent to `String`.
    *
    * The type constructor does not require any arguments.
    */
  case class StaticMethodReturnType(clazz: Class[_], name: String, arity: Int) extends TypeConstructor { 
    def kind: Kind = Kind.mkArrow(arity)
  } 
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

Successfully merging a pull request may close this issue.

1 participant