Skip to content

Loading…

when there is an implicit main and an explicit main, there should be a reasonable error given by the compiler #189

Open
baroquebobcat opened this Issue · 0 comments

1 participant

@baroquebobcat
The Mirah Community member
class Test
 def self.main(args:String[]):void
  puts "This is a test"
 end
end

puts "hello"

currently does this

$ javap Test
Compiled from "test.mirah"
public class Test extends java.lang.Object{
    public static void main(java.lang.String[]);
    public static void main(java.lang.String[]);
    public Test();
}

which understandably doesn't work.

This should be a compiler error.

odd cases:

file name & class name differ, maybe then it's ok. eg

rockem.mirah

class Guitar
  def play
    puts "twang"
  end

  def self.main(args:string[]):void
    g = Guitar.new
    g.play
  end
end

rhythm = Guitar.new
lead = Guitar.new
rhythm.play
lead.play

yields

Rockem.class w/ main as the implicit main, and Guitar w/ its explicit main.

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.