Open zxj5470 opened 6 years ago
This feature requires type inference
just needs a API to get return type from PSI
The return type must be inferred
What's the rule of parsing version number?
julia> v""
ERROR: LoadError: ArgumentError: invalid version string:
Stacktrace:
[1] VersionNumber(::String) at ./version.jl:111
[2] @v_str(::LineNumberNode, ::Module, ::Any) at ./version.jl:138
in expression starting at REPL[1]:1
Can we report errors on this?
66666666666666666
add an option for versionString in Annotator to check it...
Do we need to transform these into Kotlin?
function VersionNumber(major::VInt, minor::VInt, patch::VInt,
pre::Tuple{Vararg{Union{UInt64,String}}},
bld::Tuple{Vararg{Union{UInt64,String}}})
major >= 0 || throw(ArgumentError("invalid negative major version: $major"))
minor >= 0 || throw(ArgumentError("invalid negative minor version: $minor"))
patch >= 0 || throw(ArgumentError("invalid negative patch version: $patch"))
for ident in pre
if ident isa Integer
ident >= 0 || throw(ArgumentError("invalid negative pre-release identifier: $ident"))
else
if !occursin(r"^(?:|[0-9a-z-]*[a-z-][0-9a-z-]*)$"i, ident) ||
isempty(ident) && !(length(pre)==1 && isempty(bld))
throw(ArgumentError("invalid pre-release identifier: $(repr(ident))"))
end
end
end
for ident in bld
if ident isa Integer
ident >= 0 || throw(ArgumentError("invalid negative build identifier: $ident"))
else
if !occursin(r"^(?:|[0-9a-z-]*[a-z-][0-9a-z-]*)$"i, ident) ||
isempty(ident) && length(bld)!=1
throw(ArgumentError("invalid build identifier: $(repr(ident))"))
end
end
end
new(major, minor, patch, pre, bld)
end
Just like Kotlin type Hint or JavaX-Var-Hint