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

IDE's editor corrupts code when return types are inserted #11476

Open
JaroslavTulach opened this issue Nov 4, 2024 · 1 comment
Open

IDE's editor corrupts code when return types are inserted #11476

JaroslavTulach opened this issue Nov 4, 2024 · 1 comment
Labels
-gui p-high Should be completed in the next sprint

Comments

@JaroslavTulach
Copy link
Member

While investigating better behavior of type classes I created following program:

from Standard.Base import all
import Standard.Visualization

type R
    private V a:Text i:Integer

    as_text self = self
    as_both self = self
    as_int self = self

Text.from (that:R) = that.a
Integer.from (that:R) = that.i

main =
    n = R.V "Hi" 3
    t1 = n.as_text
    b2 = n.as_both
    i3 = n.as_int

and I tried to "type it" by enforcing return types of as_text, as_both and as_int methods. The desired state is:

    as_text self -> Text = self
    as_both self -> Text & Integer = self
    as_int self -> Integer = self

however this is what I get when trying to type it in the IDE's editor (and reload to see what actually got saved on disk):

corrupted text

Your experience may vary - but I expect the result to be similarly corrupted just like mine on 2024.5.1-nightly.2024.11.3 release. The typos seem unfixable. At the end I had to use external editor to get the correct code.

@JaroslavTulach JaroslavTulach added p-high Should be completed in the next sprint -gui labels Nov 4, 2024
@github-project-automation github-project-automation bot moved this to ❓New in Issues Board Nov 4, 2024
@JaroslavTulach JaroslavTulach changed the title IDE's editor corrupts typed in text IDE's editor corrupts code when return types are inserted Nov 4, 2024
@kazcw
Copy link
Contributor

kazcw commented Nov 4, 2024

This shows the inadequacy of our GUI parse/print-round trip tests. We should have a check in CI similar to the Rust parser's ./run libraries lint that ensures all .enso sources in libraries and tests are accurately represented; then the unit tests would only need to cover syntax errors and oddities that don't occur in idiomatic code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-gui p-high Should be completed in the next sprint
Projects
Status: New
Development

No branches or pull requests

3 participants