You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a fun bug that seems pretty hard to describe, but basically, there are two different "code paths" that reach a "different" Person even though it's actually the same exact file and type (which is a fact that Effekt doesn't understand).
Take a look at the minimal reproduction:
common.effekt
module common
record Person(name: String, birthYear: Int)
personutils.effekt
module personutils
importCommon// !!! notice the capitalisation here:// if you make it lowercase, everything works againdefcalculateAge(p: Person, currentYear: Int) =
p.birthYear - currentYear
main.effekt
module main
importcommonimportpersonutilsdefmain() = {
valjolene=Person("Jolene", 1953)
valage= calculateAge(jolene, 2025)
// ^ ERROR: Expected Person but got Person
println(age)
}
The text was updated successfully, but these errors were encountered:
if you import a module of the exact same name multiple times, everything is OK
if you import bothcommon and Common, the code now returns:
Ambiguous overload.
There are multiple overloads, which all would type check:
- common::Person: (String, Int) => Person
- common::Person: (String, Int) => Person
findSource: Trying to find: common
... ~> Some(FileSource(./common.effekt,UTF-8))
findSource: Trying to find: personutils
... ~> Some(FileSource(./personutils.effekt,UTF-8))
findSource: Trying to find: Common
... ~> Some(FileSource(./Common.effekt,UTF-8))
This is a fun bug that seems pretty hard to describe, but basically, there are two different "code paths" that reach a "different"
Person
even though it's actually the same exact file and type (which is a fact that Effekt doesn't understand).Take a look at the minimal reproduction:
common.effekt
personutils.effekt
main.effekt
The text was updated successfully, but these errors were encountered: