aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
AgeCommit message (Collapse)Author
2017-02-02Make "~s" fail for Unicode atomsBjörn Gustavsson
26b59dfe67e introduced support for arbitrary Unicode characters in atoms. After that commit, it is possible to print any atom with a "~s" format string: 1> io:format("~s\n", ['спутник']). спутник Note that the same text as a string will fail: 2> io:format("~s\n", ["спутник"]). ** exception error: bad argument in function io:format/3 called as io:format(<0.53.0>,"~s\n", [[1089,1087,1091,1090,1085,1080,1082]]) Being more permissive for atoms is probably beneficial for io:format/2. However, for io_lib:format/2, the new behavior breaks this guarantee in the documentation for io_lib:format/2: If and only if the Unicode translation modifier is used in the format string (that is, ~ts or ~tc), the resulting list can contain characters beyond the ISO Latin-1 character range (that is, numbers > 255). The problem is that you can no longer be sure whether io_lib:format/2 will return an iolist that can be successfully passed to a port or iolist_to_binary/1. We see three solutions: 1. Keep the new behavior. That means that you can get non-iolist data when you use ~s for printing an atom, but a 'badarg' when printing Unicode strings. That is inconsistent, and it delays error detection if the result is passed to a port or iolist_to_binary/1. 2. Always allow Unicode characters for ~s. That would be incompatible, because ~s says that any binary is encoded in latin1, while ~ts says that any binary is encoded in UTF-8. To implement this solution, we could no longer support latin1 binaries; all binaries would have to be encoded in UTF-8. 3. Only allow ~s for atoms where all characters are less than 256. Require ~ts to print atoms such as 'спутник'. We reject solution 1 because it is slightly incompatible and is inconsistent. We reject solution 2 because it too incompatible. Therefore, this commit implements solution 3.
2017-02-02Optimize by using async cancel_timerRaimo Niskanen
2017-02-01Bugfix: callback mode not cached after code changeRaimo Niskanen
Fix lots of internal state updates just before termination that could cause crash reports confused about timers.
2017-02-01Merge branch 'josevalim/atu8-chunk/PR-1078/OTP-14178'Björn Gustavsson
* josevalim/atu8-chunk/PR-1078/OTP-14178: Add new AtU8 beam chunk
2017-01-30Add new AtU8 beam chunkJosé Valim
The new chunk stores atoms encoded in UTF-8. beam_lib has also been modified to handle the new 'utf8_atoms' attribute while the 'atoms' attribute may be a missing chunk from now on. The binary_to_atom/2 BIF can now encode any utf8 binary with up to 255 characters. The list_to_atom/1 BIF can now accept codepoints higher than 255 with up to 255 characters (thanks to Björn Gustavsson).
2017-01-30Implement repeat_state and repeat_state_and_dataRaimo Niskanen
2017-01-25stdlib: Produce correct warning for erlang:hash/2Björn-Egil Dahlberg
2017-01-23Correct type checking function for action {next_event,,}Raimo Niskanen
2017-01-20Change arity of type to init_result/1Raimo Niskanen
2017-01-16Merge pull request #1307 from bjorng/bjorn/asn1/remove-deprecated/OTP-14146Björn Gustavsson
asn1: Remove deprecated functions OTP-14146
2017-01-13asn1: Remove deprecated functionsBjörn Gustavsson
Remove the entire asn1rt module. All functions in it were deprecated in OTP 17. In asn1ct, remove the deprecated functions asn1ct:encode/3 and asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been formally deprecated but is undocumented.
2017-01-13Merge branch 'hasse/stdlib/check_type_constraints/OTP-14070/PR-1214'Hans Bolinder
* hasse/stdlib/check_type_constraints/OTP-14070/PR-1214: stdilb: Check for bad type constraints in function types
2017-01-12Merge branch 'maint'Hans Bolinder
* maint: stdlib: Correct signatures of functions in erl_parse
2017-01-10stdlib: Correct signatures of functions in erl_parseHans Bolinder
The signatures of erl_parse:anno_to_term/1 and erl_parse:anno_from_term/1 are corrected. Using these function no longer results in false Dialyzer warnings.
2017-01-10Merge branch 'maint'Hans Bolinder
* maint: stdlib: Allow characters in types and constant patterns
2017-01-05Merge branch 'egil/stdlib/gen_event-start-2/OTP-14123'Björn-Egil Dahlberg
* egil/stdlib/gen_event-start-2/OTP-14123: stdlib: Document gen_event start options stdlib: Test gen_event options stdlib: Refactor gen_event_SUITE stdlib: Remove whitespace error in gen_event_SUITE stdlib: Add start options to gen_event stdlib: Remove whitespace errors in gen_event
2016-12-21stdlib: Allow characters in types and constant patternsHans Bolinder
Characters ($char) can be used in constant pattern expressions. They can also be used in types and contracts.
2016-12-19Add take/2 to all dictionary modulesBjörn Gustavsson
Similar to maps:take/2, add take/2 to the other dictionary modules in STDLIB: orddict:take(Key, Dict) -> {Val,NewDict} | 'error'. dict:take(Key, Dict) -> {Val,NewDict} | 'error'. gb_trees:take(Key, Dict) -> {Val,NewDict}. For gb_trees also add: gb_trees:take_any(Key, Dict) -> {Val,NewDict} | 'error'. gb_trees already has delete() and delete_any(), so we will follow that design pattern. Suggested by Boris Bochkaryov in https://github.com/erlang/otp/pull/1209.
2016-12-16stdlib: Add start options to gen_eventBjörn-Egil Dahlberg
* New gen_event:start/2 and gen_event:start_link/2 * Extend gen_event:start/1 and gen_event:start_link/1 to handle an option list as input. The options to gen_event are the same as to gen_server.
2016-12-16stdlib: Remove whitespace errors in gen_eventBjörn-Egil Dahlberg
2016-12-16Merge branch 'maint'Björn Gustavsson
* maint: Allow escripts with only two lines Add project-wide Emacs settings file
2016-12-13Allow escripts with only two linesJing Peng
The current implementation assumes that escripts all have at least three lines. But according to the escript documentation, comments on the second line and emulator flags on the third line are all optional. Thus escripts with only two lines -- shebang on the first line and code on the second line -- will not run. This commit fixes the problem by rearranging the escript header parsing logic, and recognize the escript body on the second line if the header only contains a line of shebang.
2016-12-08Printout client stacktrace when a gen_server crashesHåkan Mattsson
When a gen_server crashes it is in many cases helpful to know in which context its client made its call.
2016-12-07Merge branch 'maint'Dan Gudmundsson
* maint: Update copyright-year Conflicts: lib/dialyzer/src/dialyzer.hrl lib/dialyzer/src/dialyzer_options.erl lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer.hrl lib/dialyzer/test/opaque_SUITE_data/src/recrec/dialyzer_races.erl lib/hipe/icode/hipe_icode.erl lib/hipe/main/hipe.erl lib/hipe/main/hipe.hrl.src lib/hipe/main/hipe_main.erl
2016-12-07Update copyright-yearErlang/OTP
2016-12-05Merge branch 'richcarl/stdlib/io_lib_pretty-comments/PR-1228'Hans Bolinder
* richcarl/stdlib/io_lib_pretty-comments/PR-1228: Add comments for understanding io_lib_pretty
2016-12-02Merge branch 'richcarl/default-compiler-flags/PR-1226/OTP-14071'Björn Gustavsson
* richcarl/default-compiler-flags/PR-1226/OTP-14071: stdlib test suite: fix uses of export_all diameter tests: Eliminate use of -compile(export_all) asn1 test suite: Suppress warnings for -compile(export_all) Remove left-over uses of -compile(export_all) Make warn_export_all the default warn_obsolete_guard is already default
2016-12-01Add comments for understanding io_lib_prettyRichard Carlsson
2016-12-01stdilb: Check for bad type constraints in function typesHans Bolinder
The parser recognizes the 'is_subtype(V, T)' syntax for constraints, and of course the new 'V :: T' syntax, but other variants result in an error message. Up to now, the parser and linter have let badly formed constraints through, and relied upon Dialyzer to emit warnings. is_subtype/2 cannot easily be taken out from the parser. Not only would we need find a way to emit a (linter) warning, but there also needs to be an option for suppressing the linter warning as compilation with +warnings_as_errors has to work. (Notice that the abstract format representation for 'V :: T' is the same as for 'is_subtype(V, T)'.) This correction was triggered by an email from Robert, and Kostis created pull request 1214 to provide a fix. However, Kostis' fix disallowed is_subtype() altogether, which breaks backward compatibility. As of Erlang/OTP 19.0 (ticket OTP-11879), the 'is_subtype(V, T)' is no longer documented.
2016-11-30Merge branch 'hasse/stdlib/remove_dets_v8/OTP-13830'Hans Bolinder
* hasse/stdlib/remove_dets_v8/OTP-13830: reltool: Remove module dets_v8 runtime_tools: Remove module dets_v8 stdlib: Remove support for Dets version 8 tables
2016-11-30Merge branch 'richcarl/error_logger_tty-cleanup/PR-1256/OTP-14068'Björn Gustavsson
* richcarl/error_logger_tty-cleanup/PR-1256/OTP-14068: Write node info before log message body, not after Eliminate some code duplication
2016-11-30stdlib: Remove support for Dets version 8 tablesHans Bolinder
When at it, types have been added to record fields.
2016-11-29Make warn_export_all the defaultRichard Carlsson
2016-11-29Write node info before log message body, not afterRichard Carlsson
Make error_logger_tty_h insert node information for nonlocal messages before the message itself instead of after, both for readability and so as not to change the line termination property at the end of the message.
2016-11-29Eliminate some code duplicationRichard Carlsson
2016-11-28Merge branch 'richcarl/code-change-utils/PR-1257/OTP-14059'Björn Gustavsson
* richcarl/code-change-utils/PR-1257/OTP-14059: Update preloaded modules Add shell mm() and lm() functions Add code:module_status/1 and modified_modules/0 Fix spec for erlang:get_module_info() Handle prefetched paths Restructure code:which() and where_is_file() Remove remnants of module package support
2016-11-25Add shell mm() and lm() functionsRichard Carlsson
2016-11-23Make use of the Header feature in yeccRichard Carlsson
2016-11-23Update obsolete author e-mailsRichard Carlsson
2016-11-23Correct copyright on stdlib filesRichard Carlsson
2016-11-23Merge branch 'maint'Hans Bolinder
* maint: stdlib: Correct types of the abstract format
2016-11-22stdlib: Correct types of the abstract formatHans Bolinder
The types in erl_parse.yrl are more in harmony with the description in The Abstract Format (in ERTS User's Guide).
2016-11-17Fixup of specs in randDan Gudmundsson
Fixed bad specs introduced in commit ff568b5e818. Also suppress improper_lists warnings.
2016-11-17Merge branch 'jj1bdx/stdlib/rand-jump/PR-1235/OTP-14038'Dan Gudmundsson
* jj1bdx/stdlib/rand-jump/PR-1235/OTP-14038: Add jump functions to rand module
2016-11-14Merge branch 'tokitori/stdlib/optimize-sets/PR-1212/OTP-14035'Björn Gustavsson
* tokitori/stdlib/optimize-sets/PR-1212/OTP-14035: Speed up sets:add_element/2 and sets:del_element/2
2016-11-14Add jump functions to rand moduleKenji Rikitake
Jump functions returns the state after performing jump calculation to a rand module internal state, which is equivalent to perform a large number of calls of calculating new states for XorShift*/+ algorithms. This commit add jump functions for exsplus and exs1024 algorithms, and a wrapper function jump/1. The wrapper function will cause error with reason "not_implemented" if the jump function for the algorithm is not implemented. This commit adds following new functionalities: - Add new functions rand:jump/0 and rand:jump/1 - Add the member jump to type alg_handler(), a fun for performing the jump function - Add jump functions for exsplus, equivalent to 2^64 calls - Add jump functions for exs1024, equivalent to 2^512 calls - Revise seed_put/1, seed/1, seed/2 See <https://github.com/erlang/otp/pull/1235#discussion_r86950557> - Add dummy jump function for exs64 calling erlang:error(not_implemented) - Add jump function test cases as follows: * Add Common Test group reference_jump * Add tests for jump/0 to reference_jump_procdict/1 * Rename tests for jump/1 to reference_jump_state/1 * Rename gen_jump/1 to gen_jump_1/1 * Add Common Tests reference_jump_procdict and reference_jump_state to the group reference_jump - Add jump function documentation This commit also changes the Copyright year for Kenji Rikitake's code from 2015 to 2015-2016.
2016-11-11Merge branch 'siri/appups-20.0'Siri Hansen
* siri/appups-20.0: Update sasl/test/test_lib.hrl with recent versions of kernel and stdlib Update appups in kernel, stdlib and sasl for OTP-20
2016-11-08Speed up sets:add_element/2 and sets:del_element/2Mikhail Yashkov
Optimize sets:add_element/2 when adding an element that is already present, and sets:del_element/2 when the element to be deleted is not present. This optimization can make certain operations, such as sets:union/2 with many overlapping elements, up to two orders of magnitude faster.
2016-11-08Merge branch 'maint'Raimo Niskanen
2016-11-03Merge branch 'gandrade/fmod/PR-1216/OTP-14000'Björn Gustavsson
* gandrade/fmod/PR-1216/OTP-14000: Add test cases for math:fmod/2 BIF Support math:fmod/2 BIF on compiler Add math:fmod/2 BIF