unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.79k stars 270 forks source link

incorrect output with ambibuous names #4497

Open stew opened 11 months ago

stew commented 11 months ago

I'm getting this compiler error:


  Some common causes of this error include:
    * Your current namespace is too deep to contain the definition in its subtree
    * The definition is part of a library which hasn't been added to this project

  To add a library to this project use the command: `fork <.path.to.lib> .__projects._c8a19f50_9499_4b99_95cb_e3cdafc89545.branches._55829436_5dfc_4771_8895_390743bc271e.lib.<libname>`

  Whatever it is, its type should conform to ServerState -> cloud_4_6_6.ServiceHash a b -> aws_4_0_0.lib.http.HttpRequest -> aws_4_0_0.lib.http.HttpResponse.

  I found some terms in scope that have matching names and types. Maybe you meant one of these:

    - services.handleServiceHttpRequest : ServerState -> cloud_4_6_6.ServiceHash aws_4_0_0.lib.http.HttpRequest aws_4_0_0.lib.http.HttpResponse -> aws_4_0_0.lib.http.HttpRequest ->{IO, Abort, Random, logging.Log Event} aws_4_0_0.lib.http.HttpResponse
    - services.handleServiceHttpRequest : ServerState -> cloud_4_6_6.ServiceHash aws_4_0_0.lib.http.HttpRequest aws_4_0_0.lib.http.HttpResponse -> aws_4_0_0.lib.http.HttpRequest ->{IO, Abort, Random, logging.Log Event} aws_4_0_0.lib.http.HttpResponse

Notice that the last two lines are identical, they are both referring to services.handleServiceHttpRequest, In reality there are two different names: websockets.handleServiceHttpRequest and http.handleServiceHttpRequest:

@cloud/nimbus/mergewebsockets> names handleServiceHttpRequest

  Terms
  Hash:   #obqniljoj0
  Names:  services.handleServiceHttpRequest

  Hash:   #t7t7sjdt73
  Names:  websockets.handleServiceHttpRequest

  Tip: Use `names.global` to see more results.
mitchellwrosen commented 11 months ago

Do you happen to have a branch on Share we can check out to reproduce?

aryairani commented 6 months ago

@stew

ceedubs commented 5 months ago

Here is a transcript that reproduces the issue:

```ucm
.> project.create-empty proj
proj/main> builtins.merge
this.is.a.really_really_really_really.long.name_space.path.foo = "foo1"
this.is.another.really_really_really_really.long.name_space.path.foo = "foo2"

bar = foo