mirah 0.1.2-java → 0.1.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +225 -0
- data/Rakefile +108 -315
- data/TODO.md +100 -0
- data/bin/bundler +16 -0
- data/bin/rake +16 -0
- data/dist/mirahc.jar +0 -0
- data/examples/appengine/Readme +0 -1
- data/examples/literals.mirah +17 -0
- data/examples/macros/string_each_char.mirah +1 -1
- data/lib/mirah.rb +11 -21
- data/lib/mirah/transform/transformer.rb +1 -2
- data/lib/mirah/util/class_loader.rb +1 -1
- data/lib/mirah/util/logging.rb +0 -63
- data/lib/mirah/util/process_errors.rb +1 -0
- data/lib/mirah/version.rb +1 -1
- data/{examples/simple_class.mirah~ → test/artifacts/jar_test.rb} +7 -11
- data/{lib/mirah/commands.rb → test/artifacts/jruby_test.rb} +8 -5
- data/test/core/typer_test.rb +29 -11
- data/test/core/util/argument_processor_test.rb +24 -23
- data/test/core/util/class_loader_test.rb +7 -4
- data/test/core/util/{compilation_state_test.rb → jvm_version_test.rb} +20 -16
- data/test/fixtures/org/foo/ImplicitClassRetAnno.java +4 -0
- data/test/fixtures/org/foo/IntAnno.java +9 -0
- data/test/jvm/annotations_test.rb +11 -11
- data/test/jvm/blocks_test.rb +16 -12
- data/test/jvm/constructors_test.rb +8 -8
- data/test/jvm/enumerable_test.rb +48 -24
- data/test/jvm/generics_test.rb +3 -7
- data/test/jvm/import_test.rb +14 -0
- data/test/jvm/interface_test.rb +9 -24
- data/test/jvm/jvm_commands_test.rb +22 -4
- data/test/jvm/jvm_compiler_test.rb +124 -79
- data/test/jvm/list_extensions_test.rb +1 -1
- data/test/jvm/macros_test.rb +67 -14
- data/test/jvm/main_method_test.rb +1 -1
- data/test/jvm/new_backend_test_helper.rb +100 -3
- data/{lib/mirah/jvm/types/bitescript_ext.rb → test/jvm/static_fields_test.rb} +22 -21
- data/test/mirrors/base_type_test.rb +4 -3
- data/test/mirrors/bytecode_mirror_test.rb +35 -15
- data/test/mirrors/generics_test.rb +14 -5
- data/test/mirrors/member_test.rb +2 -1
- data/test/mirrors/method_lookup_test.rb +18 -6
- data/test/mirrors/mirrors_test.rb +87 -20
- data/test/mirrors/simple_async_mirror_loader_test.rb +7 -3
- data/test/mirrors/simple_mirror_loader_test.rb +5 -5
- data/test/test_helper.rb +25 -1
- metadata +18 -78
- data/bin/mirahp +0 -27
- data/bin/mirahp.cmd +0 -16
- data/examples/Fib.class +0 -0
- data/javalib/mirah-bootstrap.jar +0 -0
- data/javalib/mirah-builtins.jar +0 -0
- data/javalib/mirah-compiler.jar +0 -0
- data/javalib/mirah-mirrors.jar +0 -0
- data/javalib/mirah-newast-transitional.jar +0 -0
- data/javalib/mirah-parser.jar +0 -0
- data/javalib/mirah-util.jar +0 -0
- data/lib/mirah/ast.rb +0 -43
- data/lib/mirah/ast/scope.rb +0 -262
- data/lib/mirah/commands/base.rb +0 -59
- data/lib/mirah/commands/compile.rb +0 -39
- data/lib/mirah/commands/parse.rb +0 -36
- data/lib/mirah/commands/run.rb +0 -78
- data/lib/mirah/generator.rb +0 -150
- data/lib/mirah/jvm/compiler.rb +0 -50
- data/lib/mirah/jvm/compiler/base.rb +0 -421
- data/lib/mirah/jvm/compiler/jvm_bytecode.rb +0 -1194
- data/lib/mirah/jvm/method_lookup.rb +0 -307
- data/lib/mirah/jvm/types.rb +0 -45
- data/lib/mirah/jvm/types/array_type.rb +0 -60
- data/lib/mirah/jvm/types/ast_ext.rb +0 -31
- data/lib/mirah/jvm/types/basic_types.rb +0 -41
- data/lib/mirah/jvm/types/block_type.rb +0 -15
- data/lib/mirah/jvm/types/boolean.rb +0 -70
- data/lib/mirah/jvm/types/enumerable.rb +0 -80
- data/lib/mirah/jvm/types/extensions.rb +0 -110
- data/lib/mirah/jvm/types/factory.rb +0 -830
- data/lib/mirah/jvm/types/floats.rb +0 -99
- data/lib/mirah/jvm/types/generic_type.rb +0 -72
- data/lib/mirah/jvm/types/implicit_nil_type.rb +0 -29
- data/lib/mirah/jvm/types/integers.rb +0 -131
- data/lib/mirah/jvm/types/interface_definition.rb +0 -20
- data/lib/mirah/jvm/types/intrinsics.rb +0 -385
- data/lib/mirah/jvm/types/literals.rb +0 -89
- data/lib/mirah/jvm/types/meta_type.rb +0 -54
- data/lib/mirah/jvm/types/methods.rb +0 -946
- data/lib/mirah/jvm/types/null_type.rb +0 -39
- data/lib/mirah/jvm/types/number.rb +0 -184
- data/lib/mirah/jvm/types/primitive_type.rb +0 -76
- data/lib/mirah/jvm/types/source_mirror.rb +0 -274
- data/lib/mirah/jvm/types/type.rb +0 -311
- data/lib/mirah/jvm/types/type_definition.rb +0 -72
- data/lib/mirah/jvm/types/void_type.rb +0 -19
- data/lib/mirah/util/compilation_state.rb +0 -60
- data/test/core/commands_test.rb +0 -89
- data/test/core/generator_test.rb +0 -26
- data/test/fixtures/org/foo/LowerCaseInnerClass$inner.class +0 -0
- data/test/fixtures/org/foo/LowerCaseInnerClass.class +0 -0
- data/test/jvm/bytecode_test_helper.rb +0 -193
- data/test/jvm/factory_test.rb +0 -28
- data/test/jvm/java_typer_test.rb +0 -283
data/TODO.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
|
2
|
+
0.1.3 checklist
|
3
|
+
=============
|
4
|
+
|
5
|
+
- check jar CLI
|
6
|
+
org.mirah:mirah doesn't work w/o JRuby currently
|
7
|
+
org.mirah:mirah-complete jar is also broken in 0.1.2, 0.1.1
|
8
|
+
:/
|
9
|
+
otoh, probably no one is using them since they don't work
|
10
|
+
|
11
|
+
- check jruby gem
|
12
|
+
0.1.2 is the broken :(
|
13
|
+
|
14
|
+
- done: silence run compiler logging
|
15
|
+
- done: make sure in run mode we don't drop things on the filesystem
|
16
|
+
- silence logging by default in RunCommand, w/ options overriding it.
|
17
|
+
|
18
|
+
|
19
|
+
- Java 8
|
20
|
+
-- make asm new d/l dependency
|
21
|
+
-- find usages of org.jruby...asm & change them
|
22
|
+
-- rm jruby-complete asa d/l dep
|
23
|
+
-- add asm license file to dist bundle
|
24
|
+
|
25
|
+
- mirah-parser CI (ish)
|
26
|
+
- automated tests for distribution artifacts
|
27
|
+
- CI passing
|
28
|
+
|
29
|
+
|
30
|
+
------------------
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
- Check mvn compile plugin
|
37
|
+
- move build artifacts to javalib for gem
|
38
|
+
|
39
|
+
- verify bytecode version of compiler
|
40
|
+
- silence logging from JRuby interfaces, unless overridden.
|
41
|
+
|
42
|
+
Misc
|
43
|
+
===========
|
44
|
+
- mirah-parser maven artifact
|
45
|
+
|
46
|
+
- java 9
|
47
|
+
- implicit void methods w/ explicit return generate incorrect bytecode. Let's see if that's true of explicit. nope.
|
48
|
+
- get rid of all outputs that escape from tests
|
49
|
+
- default toString?
|
50
|
+
|
51
|
+
etc
|
52
|
+
=========
|
53
|
+
|
54
|
+
- Reflection Macros
|
55
|
+
- AST formatter that converts back to something the parser can parse
|
56
|
+
|
57
|
+
- switch to minitest
|
58
|
+
|
59
|
+
from notes, uncategorized
|
60
|
+
============================
|
61
|
+
#fuzzy aka cast scoping
|
62
|
+
for rescue clauses
|
63
|
+
eg
|
64
|
+
e = nil
|
65
|
+
begin
|
66
|
+
rescue X => e
|
67
|
+
# e is "X" here
|
68
|
+
rescue Y => e
|
69
|
+
# e is "Y" here
|
70
|
+
end
|
71
|
+
puts e # e is LUB(X, Y)
|
72
|
+
|
73
|
+
#behavior literate, exec spec
|
74
|
+
list o example code + what the compiler says when you give it to the compiler
|
75
|
+
things like errors, & behavior
|
76
|
+
|
77
|
+
feature requests
|
78
|
+
----------------
|
79
|
+
- goto: headius wants it
|
80
|
+
- synchronize intrinsic ala java's
|
81
|
+
- file scoped macros
|
82
|
+
- move macro / mirahc anno to separate class dir to improve javac interop
|
83
|
+
|
84
|
+
parser
|
85
|
+
-------
|
86
|
+
|
87
|
+
foo {|a| !a || ''.equals(a) }
|
88
|
+
doesn't parse
|
89
|
+
|
90
|
+
does now :)
|
91
|
+
|
92
|
+
|
93
|
+
blocks don't introduce new scopes when they are part of a macro currently :/
|
94
|
+
|
95
|
+
|
96
|
+
Release management
|
97
|
+
------------------
|
98
|
+
|
99
|
+
keep version in fewer places
|
100
|
+
whew
|
data/bin/bundler
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'bundler' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('bundler', 'bundler')
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env jruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/dist/mirahc.jar
ADDED
Binary file
|
data/examples/appengine/Readme
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
str = 'non-interpolated string'
|
2
|
+
str2 = "interpolated is better than #{str}"
|
3
|
+
heredoc = <<EOS
|
4
|
+
this is a here doc
|
5
|
+
EOS
|
6
|
+
int = 42
|
7
|
+
char = ?a
|
8
|
+
float = 3.14159265358979323846264
|
9
|
+
regex = /\d(cow)+\w\\/ # in Java, this would be "\\\\d(cow)+\\\\w\\\\\\\\"
|
10
|
+
regex2 = /interpolated #{regex}/
|
11
|
+
list = [1, 2, 3]
|
12
|
+
list[2] = 4
|
13
|
+
array = byte[5]
|
14
|
+
array[0] = byte(0)
|
15
|
+
hash = { "one" => 1, "two" => 2 }
|
16
|
+
hash["three"] = 3
|
17
|
+
|
data/lib/mirah.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010 The Mirah project authors. All Rights Reserved.
|
1
|
+
# Copyright (c) 2010-2014 The Mirah project authors. All Rights Reserved.
|
2
2
|
# All contributing project authors may be found in the NOTICE file.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -15,41 +15,30 @@
|
|
15
15
|
|
16
16
|
require 'fileutils'
|
17
17
|
require 'rbconfig'
|
18
|
-
require 'bitescript'
|
19
18
|
|
20
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../
|
21
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../javalib/mirah-parser.jar'
|
22
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../javalib/mirah-bootstrap.jar'
|
23
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../javalib/mirah-util.jar'
|
24
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../javalib/mirah-compiler.jar'
|
25
|
-
$CLASSPATH << File.dirname(__FILE__) + '/../javalib/mirah-mirrors.jar'
|
19
|
+
$CLASSPATH << File.dirname(__FILE__) + '/../dist/mirahc.jar'
|
26
20
|
|
27
21
|
require 'mirah/version'
|
28
22
|
require 'mirah/transform'
|
29
|
-
require 'mirah/ast'
|
30
|
-
require 'mirah/compiler'
|
31
23
|
require 'mirah/env'
|
32
24
|
require 'mirah/errors'
|
33
25
|
require 'mirah/typer'
|
34
|
-
require 'mirah/jvm/types'
|
35
26
|
|
36
|
-
require
|
37
|
-
|
38
|
-
require
|
27
|
+
require "mirah/util/process_errors"
|
28
|
+
require "mirah/util/logging"
|
29
|
+
require "mirah/util/class_loader"
|
39
30
|
|
40
|
-
require 'mirah/commands'
|
41
31
|
|
42
32
|
module Mirah
|
33
|
+
java_import 'org.mirah.tool.RunCommand'
|
34
|
+
java_import 'org.mirah.tool.Mirahc'
|
35
|
+
|
43
36
|
def self.run(*args)
|
44
|
-
Mirah::
|
37
|
+
Mirah::RunCommand.run(args)
|
45
38
|
end
|
46
39
|
|
47
40
|
def self.compile(*args)
|
48
|
-
Mirah::
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.parse(*args)
|
52
|
-
Mirah::Commands::Parse.new(args).execute
|
41
|
+
Mirah::Mirahc.new.compile(args)
|
53
42
|
end
|
54
43
|
|
55
44
|
def self.plugins
|
@@ -102,6 +91,7 @@ module Mirah
|
|
102
91
|
endcol = end_col if lineno == end_line
|
103
92
|
|
104
93
|
result << "^" * [endcol - start, 1].max
|
94
|
+
|
105
95
|
result << "\n"
|
106
96
|
end
|
107
97
|
result
|
@@ -25,12 +25,11 @@ module Mirah
|
|
25
25
|
attr_reader :errors, :state
|
26
26
|
attr_accessor :filename
|
27
27
|
|
28
|
-
def initialize(
|
28
|
+
def initialize(typer)
|
29
29
|
@errors = []
|
30
30
|
@tmp_count = 0
|
31
31
|
@annotations = []
|
32
32
|
@extra_body = nil
|
33
|
-
@state = state
|
34
33
|
@typer = typer
|
35
34
|
@types = typer.type_system if typer
|
36
35
|
@files = {""=>{:filename => "", :line => 0, :code => ""}}
|
data/lib/mirah/util/logging.rb
CHANGED
@@ -6,69 +6,6 @@ module Mirah
|
|
6
6
|
java_import 'java.util.logging.Level'
|
7
7
|
|
8
8
|
MirahLogger = Logger.getLogger('org.mirah')
|
9
|
-
MirahHandler = ConsoleHandler.new
|
10
|
-
MirahLogger.addHandler(MirahHandler)
|
11
|
-
MirahLogger.use_parent_handlers = false
|
12
|
-
MirahHandler.level = Level::ALL
|
13
|
-
|
14
|
-
class LogFormatter < Formatter
|
15
|
-
def initialize(use_color=true)
|
16
|
-
@color = use_color
|
17
|
-
@names = {}
|
18
|
-
@inverse_names = {}
|
19
|
-
end
|
20
|
-
|
21
|
-
def format_name(sb, level, name)
|
22
|
-
sb.append("\e[1m") if @color
|
23
|
-
sb.append("* [")
|
24
|
-
if @color && level > 800
|
25
|
-
if level > 900
|
26
|
-
sb.append("\e[31m")
|
27
|
-
else
|
28
|
-
sb.append("\e[34m")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
sb.append(shorten(name))
|
32
|
-
sb.append("\e[39m") if @color
|
33
|
-
sb.append('] ')
|
34
|
-
sb.append("\e[0m") if @color
|
35
|
-
end
|
36
|
-
|
37
|
-
def shorten(name)
|
38
|
-
short = @names[name]
|
39
|
-
return short if short
|
40
|
-
pieces = name.split('.')
|
41
|
-
pieces.size.times do |i|
|
42
|
-
key = pieces[-i - 1, i + 1]
|
43
|
-
existing = @inverse_names[key]
|
44
|
-
if existing.nil? || existing == [name]
|
45
|
-
@inverse_names[key] = [name]
|
46
|
-
return @names[name] = key.join('.')
|
47
|
-
else
|
48
|
-
existing.each {|i| @names[i] = nil}
|
49
|
-
existing << name unless existing.include?(name)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
return name
|
53
|
-
end
|
54
|
-
|
55
|
-
def format(record)
|
56
|
-
sb = java.lang.StringBuilder.new
|
57
|
-
format_name(sb, record.level.int_value, record.logger_name)
|
58
|
-
sb.append(formatMessage(record))
|
59
|
-
sb.append("\n")
|
60
|
-
if record.thrown
|
61
|
-
sw = java.io.StringWriter.new
|
62
|
-
pw = java.io.PrintWriter.new(sw)
|
63
|
-
record.thrown.printStackTrace(pw)
|
64
|
-
pw.close
|
65
|
-
sb.append(sw.toString)
|
66
|
-
end
|
67
|
-
sb.toString
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
MirahHandler.formatter = LogFormatter.new
|
72
9
|
|
73
10
|
module Logged
|
74
11
|
VLEVELS = [Level::CONFIG, Level::FINE, Level::FINER, Level::FINEST]
|
data/lib/mirah/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010 The Mirah project authors. All Rights Reserved.
|
1
|
+
# Copyright (c) 2010-2014 The Mirah project authors. All Rights Reserved.
|
2
2
|
# All contributing project authors may be found in the NOTICE file.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -13,15 +13,11 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
|
17
|
-
def initialize
|
18
|
-
puts 'constructor'
|
19
|
-
@hello = 'Hello, '
|
20
|
-
end
|
16
|
+
require 'test_helper'
|
21
17
|
|
22
|
-
|
23
|
-
|
18
|
+
class JarTest < Test::Unit::TestCase
|
19
|
+
def test_happy_path
|
20
|
+
out = `java -jar dist/mirahc.jar run -e 'puts 1'`
|
21
|
+
assert_equal "1\n", out
|
24
22
|
end
|
25
|
-
end
|
26
|
-
|
27
|
-
Foo.new.hello('Mirah')
|
23
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010 The Mirah project authors. All Rights Reserved.
|
1
|
+
# Copyright (c) 2010-2014 The Mirah project authors. All Rights Reserved.
|
2
2
|
# All contributing project authors may be found in the NOTICE file.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -13,7 +13,10 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require '
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
require 'test_helper'
|
17
|
+
|
18
|
+
class JrubyTest < Test::Unit::TestCase
|
19
|
+
def test_happy_path_works
|
20
|
+
Mirah.compile '-e', '1+1'
|
21
|
+
end
|
22
|
+
end
|
data/test/core/typer_test.rb
CHANGED
@@ -42,7 +42,7 @@ class TyperTest < Test::Unit::TestCase
|
|
42
42
|
def new_typer(n)
|
43
43
|
@types = SimpleTypes.new(n.to_s)
|
44
44
|
@typer = Mirah::Typer::Typer.new(@types, @scopes, nil, nil)
|
45
|
-
@mirah = Transform::Transformer.new(
|
45
|
+
@mirah = Transform::Transformer.new(@typer)
|
46
46
|
@typer
|
47
47
|
end
|
48
48
|
|
@@ -214,12 +214,15 @@ class TyperTest < Test::Unit::TestCase
|
|
214
214
|
assert_equal(@types.getFloatType(1.0), inferred_type(ast.get(1)).returnType)
|
215
215
|
end
|
216
216
|
|
217
|
-
def
|
218
|
-
|
217
|
+
def test_if_incompatible_body_types_float_string
|
218
|
+
pend_on_jruby "1.7.13" do
|
219
|
+
ast = parse("if true; 1.0; else; ''; end").body
|
219
220
|
|
220
|
-
|
221
|
-
|
221
|
+
assert_equal(':error', infer(ast).name)
|
222
|
+
end
|
223
|
+
end
|
222
224
|
|
225
|
+
def test_if_not_error_on_same_type_float
|
223
226
|
ast = parse("if true; 1.0; else; 2.0; end").body.get(0)
|
224
227
|
|
225
228
|
assert_not_equal(':error', infer(ast).name)
|
@@ -227,7 +230,9 @@ class TyperTest < Test::Unit::TestCase
|
|
227
230
|
assert_equal(@types.getBooleanType, inferred_type(ast.condition))
|
228
231
|
assert_equal(@types.getFloatType(1.0), inferred_type(ast.body))
|
229
232
|
assert_equal(@types.getFloatType(1.0), inferred_type(ast.elseBody))
|
233
|
+
end
|
230
234
|
|
235
|
+
def test_if
|
231
236
|
typer = new_typer(:Bar)
|
232
237
|
|
233
238
|
ast = parse("if foo; bar; else; baz; end").body.get(0)
|
@@ -266,9 +271,11 @@ class TyperTest < Test::Unit::TestCase
|
|
266
271
|
end
|
267
272
|
|
268
273
|
def test_rescue_w_different_type_raises_inference_error_when_expression
|
269
|
-
|
270
|
-
|
271
|
-
|
274
|
+
pend_on_jruby "1.7.13" do
|
275
|
+
ast = parse("1 + begin true; 1.0; rescue; ''; end")
|
276
|
+
infer(ast, true)
|
277
|
+
assert_errors_including "Incompatible types", @typer, ast
|
278
|
+
end
|
272
279
|
end
|
273
280
|
|
274
281
|
def test_rescue_w_different_type_doesnt_raise_inference_error_when_statement
|
@@ -280,7 +287,7 @@ class TyperTest < Test::Unit::TestCase
|
|
280
287
|
def test_colon2
|
281
288
|
ast = parse("java::lang::System.out")
|
282
289
|
infer(ast)
|
283
|
-
target_type = inferred_type(ast.body(0).target)
|
290
|
+
target_type = inferred_type(ast.body(0).get(0).target)
|
284
291
|
assert_equal('java.lang.System', target_type.name)
|
285
292
|
end
|
286
293
|
|
@@ -296,7 +303,18 @@ class TyperTest < Test::Unit::TestCase
|
|
296
303
|
infer(ast)
|
297
304
|
assert_equal(@types.getFixnumType(1), inferred_type(ast.body(2)))
|
298
305
|
assert_equal(@types.getNullType, inferred_type(ast.body(3)))
|
299
|
-
|
300
|
-
assert_kind_of(
|
306
|
+
|
307
|
+
assert_kind_of(LocalAccess, ast.body(2).get(0))
|
308
|
+
assert_kind_of(FunctionalCall, ast.body(3).get(0).get(0))
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_import
|
312
|
+
pend_on_jruby "1.7.13" do
|
313
|
+
ast = parse("import FooBar")
|
314
|
+
assert_equal("Void", infer(ast).name)
|
315
|
+
ast = parse("import foobar")
|
316
|
+
infer(ast)
|
317
|
+
assert_errors_including("Cannot find class foobar", @typer, ast)
|
318
|
+
end
|
301
319
|
end
|
302
320
|
end
|