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

(wip) fixes #1747 - provide more helpful error message running term with bad type #1

Closed
wants to merge 3 commits into from

Conversation

samgqroberts
Copy link
Owner

@samgqroberts samgqroberts commented Feb 10, 2021

aiming to fix unisonweb#1747

@samgqroberts
Copy link
Owner Author

samgqroberts commented Feb 10, 2021

At this point, given scratch file contents:

main = '(printLine "printed main")

main' = 'printLine "printed main'"

ucm will give this output when trying to run stuff:

.> run main

  😶
  
  I found this function:
  
    main : '{base.io.IO} ()
  
  but in order for me to `run` it it needs to have the type:
  
    main : '{base.io.IO} a

.> run main'

  😶
  
  I found this function:
  
    main' : base.Text ->{base.io.IO} ()
  
  but in order for me to `run` it it needs to have the type:
  
    main' : '{base.io.IO} a

.> run notfound
NameOnly notfound

  😶
  
  I looked for a function `notfound` in the most recently typechecked file and codebase but
  couldn't find one. It has to have the type:
  
    notfound : '{base.io.IO} a

Before this PR, running main' would have given the same output as running notfound.

Note that running main should successfully run the program, but I believe I'm running into unisonweb#1800

Otherwise the big TODO is to bring this new helpful error message to the situation where the term to run is found in the codebase (TODO annotated in the code) Done

TODO: provide this when the term is found in the Codebase, not just the
scratch file
@samgqroberts
Copy link
Owner Author

And with an empty scratch file, and main and main' added to the codebase, we get a similar helpful error message (and a similar bug from unisonweb#1800!)

.> view main

  main : '{IO} ()
  main = '(printLine "printed main")

.> view main'

  main' : Text ->{IO} ()
  main' = 'printLine "printed main'"

.> run main
NameOnly main
Just (∀ (User "()". (User "g". Var User "()" -> ({[Var User "g",#fgaev]} #568rs))))

  😶
  
  I found this function:
  
    main : '{base.io.IO} ()
  
  but in order for me to `run` it it needs to have the type:
  
    main : '{base.io.IO} a

.> run main'
NameOnly main'
Just (##Text -> (({[#fgaev]} #568rs)))

  😶
  
  I found this function:
  
    main' : base.Text ->{base.io.IO} ()
  
  but in order for me to `run` it it needs to have the type:
  
    main' : '{base.io.IO} a

.> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run reports that a given term does not exist if that term does not have the proper type
1 participant