Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ruby-dhallish
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
basst
ruby-dhallish
Commits
ba2b1a4c
Commit
ba2b1a4c
authored
Mar 4, 2019
by
Philipp Panzer
Browse files
Options
Downloads
Patches
Plain Diff
fix bug in unification
parent
8f43e97c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
lib/ast.rb
+1
-1
1 addition, 1 deletion
lib/ast.rb
lib/types.rb
+1
-2
1 addition, 2 deletions
lib/types.rb
with
3 additions
and
3 deletions
README.md
+
1
−
0
View file @
ba2b1a4c
...
@@ -32,3 +32,4 @@ ruby ./tests/test.rb
...
@@ -32,3 +32,4 @@ ruby ./tests/test.rb
-
[ ] disallow Type Names like
`Natural`
or
`let`
as labels
-
[ ] disallow Type Names like
`Natural`
or
`let`
as labels
-
[ ] more tests and tests for expected failure
-
[ ] more tests and tests for expected failure
-
[ ] "n-1": currently interpreted as label, but should be a subtraction (sometimes)
-
[ ] "n-1": currently interpreted as label, but should be a subtraction (sometimes)
-
[ ] Warum funktionieren Typannotationen in lets mit verschiedenen Typvariablen?
This diff is collapsed.
Click to expand it.
lib/ast.rb
+
1
−
1
View file @
ba2b1a4c
...
@@ -426,7 +426,7 @@ module Dhallish
...
@@ -426,7 +426,7 @@ module Dhallish
type_type
=
@type
.
compute_type
ctx
type_type
=
@type
.
compute_type
ctx
assert
(
"Annotated expression not a type"
)
{
type_type
.
is_a?
Types
::
Type
}
assert
(
"Annotated expression not a type"
)
{
type_type
.
is_a?
Types
::
Type
}
exp_type
=
type_type
.
metadata
exp_type
=
type_type
.
metadata
assert
(
"Expression does not match annotated type. Actual:
#{
act_type
}
, expected:
#{
exp_type
}
"
)
{
act_type
==
exp_type
}
assert
(
"Expression does not match annotated type. Actual:
#{
act_type
}
, expected:
#{
exp_type
}
"
)
{
Types
::
unification
act_type
,
exp_type
}
exp_type
exp_type
end
end
...
...
This diff is collapsed.
Click to expand it.
lib/types.rb
+
1
−
2
View file @
ba2b1a4c
...
@@ -149,7 +149,6 @@ module Dhallish
...
@@ -149,7 +149,6 @@ module Dhallish
module_function
:resolve
module_function
:resolve
def
unification
(
a
,
b
,
mapping
=
{})
def
unification
(
a
,
b
,
mapping
=
{})
assert
(
"a and b must be types"
)
{
is_a_type
(
a
)
and
is_a_type
(
b
)
}
case
a
case
a
when
Type
when
Type
if
b
.
is_a?
Type
if
b
.
is_a?
Type
...
@@ -162,7 +161,7 @@ module Dhallish
...
@@ -162,7 +161,7 @@ module Dhallish
if
mapping
[
a
.
name
]
==
nil
if
mapping
[
a
.
name
]
==
nil
mapping
[
a
.
name
]
=
b
.
name
mapping
[
a
.
name
]
=
b
.
name
mapping
mapping
elsif
mapping
[
a
.
name
]
!=
mapping
[
b
.
name
]
elsif
mapping
[
a
.
name
]
!=
b
.
name
nil
nil
else
else
mapping
mapping
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment