mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Merge branch 'master' into abstract-a-la-carte-terms
This commit is contained in:
commit
7e5d2d6da3
24
.travis.yml
24
.travis.yml
@ -19,8 +19,8 @@ before_cache:
|
|||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- compiler: "ghc-8.6.4"
|
- compiler: "ghc-8.6.5"
|
||||||
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}}
|
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.5], sources: [hvr-ghc]}}
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- mkdir -p $HOME/.local/bin
|
- mkdir -p $HOME/.local/bin
|
||||||
@ -29,19 +29,19 @@ before_install:
|
|||||||
- cabal --version
|
- cabal --version
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cabal new-update -v
|
- cabal v2-update -v
|
||||||
- cabal new-configure --enable-tests --enable-benchmarks --disable-optimization --write-ghc-environment-files=always --jobs=2
|
- cabal v2-configure --enable-tests --enable-benchmarks --disable-optimization --write-ghc-environment-files=always --jobs=2
|
||||||
- cabal new-build --only-dependencies
|
- cabal v2-build --only-dependencies
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cabal new-build
|
- cabal v2-build
|
||||||
- cabal new-run semantic:test
|
- cabal v2-run semantic:test
|
||||||
- cabal new-run semantic-core:test
|
- cabal v2-run semantic-core:test
|
||||||
- cabal new-run semantic-python:test
|
- cabal v2-run semantic-python:test
|
||||||
- cabal new-run semantic-source:test
|
- cabal v2-run semantic-source:test
|
||||||
- cabal new-run semantic-source:doctest
|
- cabal v2-run semantic-source:doctest
|
||||||
# parse-examples is disabled because it slaughters our CI
|
# parse-examples is disabled because it slaughters our CI
|
||||||
# - cabal new-run semantic:parse-examples
|
# - cabal v2-run semantic:parse-examples
|
||||||
|
|
||||||
# Any branch linked with a pull request will be built, as well as the non-PR
|
# Any branch linked with a pull request will be built, as well as the non-PR
|
||||||
# branches listed below:
|
# branches listed below:
|
||||||
|
@ -16,6 +16,8 @@ copyright: (c) 2019 GitHub, Inc.
|
|||||||
category: Language
|
category: Language
|
||||||
extra-source-files: CHANGELOG.md
|
extra-source-files: CHANGELOG.md
|
||||||
|
|
||||||
|
tested-with: GHC == 8.6.5
|
||||||
|
|
||||||
library
|
library
|
||||||
exposed-modules:
|
exposed-modules:
|
||||||
-- other-modules:
|
-- other-modules:
|
||||||
|
@ -16,7 +16,7 @@ build-type: Simple
|
|||||||
stability: alpha
|
stability: alpha
|
||||||
extra-source-files: README.md
|
extra-source-files: README.md
|
||||||
|
|
||||||
tested-with: GHC == 8.6.4
|
tested-with: GHC == 8.6.5
|
||||||
|
|
||||||
common haskell
|
common haskell
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
@ -206,8 +206,9 @@ instance Compile Py.ClassDefinition where
|
|||||||
pure (typefn $$ Core.string (coerce n) $$ object $$ contents)
|
pure (typefn $$ Core.string (coerce n) $$ object $$ contents)
|
||||||
|
|
||||||
body <- compile pybody buildTypeCall next
|
body <- compile pybody buildTypeCall next
|
||||||
let assignClass = Name.named' n :<- body
|
let coreName = Name.named' n
|
||||||
let continuing = fmap (locate it . (assignClass >>>=))
|
assignClass = coreName :<- (rec coreName body)
|
||||||
|
continuing = fmap (locate it . (assignClass >>>=))
|
||||||
continuing (local (def n) (cc next))
|
continuing (local (def n) (cc next))
|
||||||
|
|
||||||
instance Compile Py.ComparisonOperator
|
instance Compile Py.ComparisonOperator
|
||||||
@ -277,7 +278,7 @@ instance Compile Py.FunctionDefinition where
|
|||||||
parameters' <- traverse param parameters
|
parameters' <- traverse param parameters
|
||||||
body' <- compile body pure next
|
body' <- compile body pure next
|
||||||
-- Build a lambda.
|
-- Build a lambda.
|
||||||
let located = locate it (lams parameters' body')
|
let located = locate it (rec (Name.named' (Name name)) (lams parameters' body'))
|
||||||
-- Give it a name (below), then augment the current continuation
|
-- Give it a name (below), then augment the current continuation
|
||||||
-- with the new name (with 'def'), so that calling contexts know
|
-- with the new name (with 'def'), so that calling contexts know
|
||||||
-- that we have built an exportable definition.
|
-- that we have built an exportable definition.
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# CHECK-TREE: { foo <- (\a -> a); #record { foo: foo } }
|
# CHECK-TREE: { foo <- rec foo = \a -> a; #record { foo: foo } }
|
||||||
def foo(a):
|
def foo(a):
|
||||||
return a
|
return a
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { foo <- (\a -> a); #record { foo: foo } }
|
# CHECK-TREE: { foo <- rec foo = (\a -> a); #record { foo: foo } }
|
||||||
|
|
||||||
def foo(a):
|
def foo(a):
|
||||||
return a
|
return a
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { foo <- \a -> if a then a else #unit; #record { foo: foo } }
|
# CHECK-TREE: { foo <- rec foo = \a -> if a then a else #unit; #record { foo: foo } }
|
||||||
|
|
||||||
def foo(a):
|
def foo(a):
|
||||||
if a: return a
|
if a: return a
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { const <- \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }}
|
# CHECK-TREE: { const <- rec const = \x -> \y -> x; y <- const #true #true; z <- const #false #false; #record { const: const, y : y, z: z, }}
|
||||||
def const(x, y): return x
|
def const(x, y): return x
|
||||||
y = const(True, True)
|
y = const(True, True)
|
||||||
z = const(False, False)
|
z = const(False, False)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { const <- \a -> \b -> { identity <- \x -> x; identity a }; #record{ const: const }}
|
# CHECK-TREE: { const <- rec const = \a -> \b -> { identity <- rec identity = \x -> x; identity a }; #record{ const: const }}
|
||||||
|
|
||||||
def const(a, b):
|
def const(a, b):
|
||||||
def identity(x):
|
def identity(x):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { passthru <- \x -> x; decorated <- \x -> x; decorated = passthru(decorated); #record { passthru: passthru, decorated: decorated }}
|
# CHECK-TREE: { passthru <- rec passthru = \x -> x; decorated <- rec decorated = \x -> x; decorated = passthru(decorated); #record { passthru: passthru, decorated: decorated }}
|
||||||
def passthru(x):
|
def passthru(x):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# CHECK-TREE: { Foo <- __semantic_prelude.type "Foo" __semantic_prelude.object #record {}; #record { Foo: Foo }}
|
# CHECK-TREE: { Foo <- rec Foo = __semantic_prelude.type "Foo" __semantic_prelude.object #record {}; #record { Foo: Foo }}
|
||||||
class Foo():
|
class Foo():
|
||||||
pass
|
pass
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# CHECK-TREE: { Foo <- { identity <- \self -> \x -> x; __semantic_prelude.type "Foo" __semantic_prelude.object #record { identity: identity } }; #record { Foo: Foo } }
|
# CHECK-TREE: { Foo <- rec Foo = { identity <- rec identity = \self -> \x -> x; __semantic_prelude.type "Foo" __semantic_prelude.object #record { identity: identity } }; #record { Foo: Foo } }
|
||||||
|
|
||||||
class Foo():
|
class Foo():
|
||||||
def identity(self, x):
|
def identity(self, x):
|
||||||
|
2
semantic-python/test/fixtures/3-03-functions-know-their-own-names.py
vendored
Normal file
2
semantic-python/test/fixtures/3-03-functions-know-their-own-names.py
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# CHECK-TREE: { recursive <- rec recursive = \a -> recursive; #record { recursive: recursive }}
|
||||||
|
def recursive(a): return recursive
|
@ -16,7 +16,7 @@ build-type: Simple
|
|||||||
stability: alpha
|
stability: alpha
|
||||||
extra-source-files: README.md
|
extra-source-files: README.md
|
||||||
|
|
||||||
tested-with: GHC == 8.6.4
|
tested-with: GHC == 8.6.5
|
||||||
|
|
||||||
flag release
|
flag release
|
||||||
description: Build with optimizations on (for CI or deployment builds)
|
description: Build with optimizations on (for CI or deployment builds)
|
||||||
|
Loading…
Reference in New Issue
Block a user