Skip to content

Move All Resolution to the Resolution Stage #297

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

Merged
merged 33 commits into from
Apr 26, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
452f81a
Move all resolution to the resolution stage
FlandiaYingman Apr 16, 2025
424b104
Funny test cases
FlandiaYingman Apr 16, 2025
c8f9a0c
Changes from meeting
LPTK Apr 16, 2025
b3e2e89
Improved Symbol Resolution
FlandiaYingman Apr 22, 2025
d3e10df
Update hkmc2/shared/src/test/mlscript/codegen/FunnyOpen.mls
FlandiaYingman Apr 22, 2025
20f8401
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Term.scala
FlandiaYingman Apr 22, 2025
5b01df0
Meaningless Underscore
FlandiaYingman Apr 22, 2025
f1a13ca
Revert HkScratch.mls
FlandiaYingman Apr 22, 2025
b77b920
Fix funny BBML problem
FlandiaYingman Apr 23, 2025
1640526
Fix funny changes
FlandiaYingman Apr 23, 2025
4e731a1
Funny restParam
FlandiaYingman Apr 23, 2025
133c5b2
Good job
FlandiaYingman Apr 23, 2025
2c33835
Fix whitespace
FlandiaYingman Apr 23, 2025
c3c5e8f
TyApp implict resolution
FlandiaYingman Apr 23, 2025
3522036
Funny Fix
FlandiaYingman Apr 23, 2025
3c41858
Fix ref resolution
FlandiaYingman Apr 23, 2025
1c7e9c2
Merge branch 'hkmc2' into move-implicit-resolution
FlandiaYingman Apr 23, 2025
cfa6077
Funny test diff
FlandiaYingman Apr 23, 2025
a83d71c
Merge branch 'hkmc2' into move-implicit-resolution
FlandiaYingman Apr 25, 2025
13d0dc7
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
51e907c
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
74fadce
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Elaborator.scala
FlandiaYingman Apr 25, 2025
99726ff
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
96d9a17
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
2c2f7c0
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
778228f
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
b2cb124
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 25, 2025
ce4e1f3
Fix comments
FlandiaYingman Apr 25, 2025
6307b89
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
FlandiaYingman Apr 26, 2025
c3eb4d1
wrap line
FlandiaYingman Apr 26, 2025
8c04952
FIx symbol
FlandiaYingman Apr 26, 2025
413ac95
Fix lowering symbol
FlandiaYingman Apr 26, 2025
8fcd996
Update hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
LPTK Apr 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions hkmc2/shared/src/test/mlscript/codegen/FunnyOpen.mls
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@

module Mod with
fun print(x) = console.log(x)
fun (|>) pipe(x, f) = f(x)
fun (|>>) pipee(x, f) = f(x)

:ctx
open Mod
//│ Env:
//│ pipe -> SelElem(RefElem(member:Mod),pipe,Some(member:pipe),true)
//│ pipee -> SelElem(RefElem(member:Mod),pipee,Some(member:pipee),true)
//│ print -> SelElem(RefElem(member:Mod),print,Some(member:print),true)
//│ |> -> SelElem(RefElem(member:Mod),pipe,Some(member:pipe),true)
//│ |>> -> SelElem(RefElem(member:Mod),pipee,Some(member:pipee),true)

pipe
//│ = [function pipe]
pipee
//│ = [function pipee]

(|>)
//│ = [function pipe]
(|>>)
//│ = [function pipee]

|>
//│ = [function pipe]
|>>
//│ = [function pipee]

:pe
:e
Mod.|>
Mod.|>>
//│ ╔══[PARSE ERROR] Expected start of statement in this position; found end of input instead
//│ ║ l.26: Mod.|>
//│ ╙── ^
//│ ╔══[ERROR] Name not found: .|>
//│ ║ l.26: Mod.|>
//│ ╙── ^^^
//│ ║ l.26: Mod.|>>
//│ ╙── ^
//│ ╔══[ERROR] Name not found: .|>>
//│ ║ l.26: Mod.|>>
//│ ╙── ^^^^
//│ ╔══[ERROR] Unexpected moduleful reference.
//│ ║ l.26: Mod.|>
//│ ║ l.26: Mod.|>>
//│ ╙── ^^^


1 |> x => print(x)
1 |>> x => print(x)
//│ > 1


:pe
:e
open Mod { |> }
open Mod { |>> }
//│ ╔══[PARSE ERROR] Expected start of statement in this position; found end of input instead
//│ ║ l.44: open Mod { |> }
//│ ╙── ^
//│ ║ l.44: open Mod { |>> }
//│ ╙── ^
//│ ╔══[ERROR] Illegal 'open' statement shape.
//│ ║ l.44: open Mod { |> }
//│ ╙── ^^^^^^^^^
//│ ║ l.44: open Mod { |>> }
//│ ╙── ^^^^^^^^^^


:e
open Mod { (|>) }
open Mod { (|>>) }
//│ ╔══[ERROR] Illegal 'open' statement element.
//│ ║ l.54: open Mod { (|>) }
//│ ╙── ^^^^
//│ ║ l.54: open Mod { (|>>) }
//│ ╙── ^^^^^

12 |> print
12 |>> print
//│ > 12


open Mod { print, |> }
open Mod { print, |>> }

:fixme
12 |> print
//│ ╔══[ERROR] Module 'Mod' does not contain member '|>'
//│ ║ l.66: 12 |> print
//│ ╙── ^^
//│ ═══[RUNTIME ERROR] TypeError: Mod1.|> is not a function
12 |>> print
//│ ╔══[ERROR] Module 'Mod' does not contain member '|>>'
//│ ║ l.66: 12 |>> print
//│ ╙── ^^^
//│ ═══[RUNTIME ERROR] TypeError: Mod1.|>> is not a function


28 changes: 28 additions & 0 deletions hkmc2/shared/src/test/mlscript/ctx/TrickyResolution.mls
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
:js


class Foo[A]
class Bar[B]


:fixme
fun foo[A](using Foo[A], Bar[A])
//│ /!!!\ Uncaught error: scala.MatchError: App(Ident(Bar),TyTup(List(Ident(A)))) (of class hkmc2.syntax.Tree$App)


fun foo[A](using f: Foo[A], b: Bar[A]): A

use Foo[Str] = new Foo
use Foo[Int] = new Foo

use Bar[Int] = new Bar
use Bar[Str] = new Bar


// * Probably picks A = Int due to the Foo constraint, picking up the latest-defined Foo instance,
// * and thus picks the Bar[Int] instance
:fixme
foo
//│ /!!!\ Uncaught error: hkmc2.InternalError: Not in scope: member:foo (class hkmc2.semantics.BlockMemberSymbol)


Loading