Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Can declare two methods with the same name and different arguments #3099

Closed
Emm opened this Issue · 3 comments

3 participants

@Emm
Emm commented
fn a(x: ~str) -> ~str {
    #fmt("First function with %s", x)
}

fn a(x: ~str, y: ~str) -> ~str {
    #fmt("Second function with %s and %s", x, y)
}

fn main() {
    #info("Result: ");
}

Compiles with a recent rust master (899400c) (but using a(x: ~str) does not compile)

@catamorphism catamorphism was assigned
@Dretch

You can also declare different types with the same name. This compiles and runs:

enum x {}

trait x {}

type x = int;

struct x { a: int; }

fn main() {
    let x:x = fail;
}
@catamorphism

I'm working on fixing both of these issues.

@Dretch

Thats great @catamorphism, thanks!

@jayanderson jayanderson referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@catamorphism catamorphism was unassigned by Emm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.