Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read(filename, String) is not type stable #26419

Closed
xitology opened this issue Mar 12, 2018 · 2 comments
Closed

read(filename, String) is not type stable #26419

xitology opened this issue Mar 12, 2018 · 2 comments
Assignees
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version

Comments

@xitology
Copy link
Contributor

In 0.7-DEV, readstring(filename) is deprecated in favor of read(filename, String). However, the latter is not type stable. readstring(filename) was type stable in 0.6.

julia> versioninfo()
Julia Version 0.7.0-DEV.4537
Commit 61bf9359e9 (2018-03-11 19:30 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:

julia> readstring("/dev/null")
┌ Warning: `readstring(filename::AbstractString)` is deprecated, use `read(filename, String)` instead.
│   caller = top-level scope
└ @ Core :0
""

help?> read
  ...
  read(filename::AbstractString, String)
  Read the entire contents of a file as a string.
  ...

julia> Core.Compiler.return_type(read, (String, Type{String}))
Any
@JeffBezanson
Copy link
Member

Probably same cause as #19096, perhaps #26050.

@JeffBezanson JeffBezanson added the compiler:inference Type inference label Mar 12, 2018
@nalimilan nalimilan added the regression Regression in behavior compared to a previous version label Mar 12, 2018
@vtjnash
Copy link
Member

vtjnash commented Jul 10, 2018

Not quite the same, since this is creating a closure too. If it was just slurping, that would be fixed now by #26826.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

4 participants