File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,24 @@ private macro def_string_methods(klass)
8282 def lines : ArrayLiteral (StringLiteral )
8383 end
8484
85- # Similar to `String#split`.
85+ # Similar to `String#split() `.
8686 def split : ArrayLiteral (StringLiteral )
8787 end
8888
89- # Similar to `String#split`.
89+ # Similar to `String#split(String)`.
90+ def split (node : StringLiteral ) : ArrayLiteral (StringLiteral )
91+ end
92+
93+ # Similar to `String#split(Char)`.
94+ def split (node : CharLiteral ) : ArrayLiteral (StringLiteral )
95+ end
96+
97+ # Similar to `String#split(Regex)`.
98+ def split (node : RegexLiteral ) : ArrayLiteral (StringLiteral )
99+ end
100+
101+ # Similar to `String#split(String)`.
102+ @[Deprecated (" Use `#split(StringLiteral)` instead" )]
90103 def split (node : ASTNode ) : ArrayLiteral (StringLiteral )
91104 end
92105
Original file line number Diff line number Diff line change @@ -855,6 +855,7 @@ module Crystal
855855 when RegexLiteral
856856 splitter = regex_value(arg)
857857 else
858+ interpreter.warnings.add_warning_at(name_loc, " Deprecated StringLiteral#split(ASTNode). Use `#split(StringLiteral)` instead" )
858859 splitter = arg.to_s
859860 end
860861
You can’t perform that action at this time.
0 commit comments