1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Merge branch 'master' into abstract-a-la-carte-terms

This commit is contained in:
Rob Rix 2019-10-21 16:40:59 -04:00
commit 7e5d2d6da3
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7
14 changed files with 30 additions and 25 deletions

View File

@ -19,8 +19,8 @@ before_cache:
matrix:
include:
- compiler: "ghc-8.6.4"
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}}
- compiler: "ghc-8.6.5"
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.5], sources: [hvr-ghc]}}
before_install:
- mkdir -p $HOME/.local/bin
@ -29,19 +29,19 @@ before_install:
- cabal --version
install:
- cabal new-update -v
- cabal new-configure --enable-tests --enable-benchmarks --disable-optimization --write-ghc-environment-files=always --jobs=2
- cabal new-build --only-dependencies
- cabal v2-update -v
- cabal v2-configure --enable-tests --enable-benchmarks --disable-optimization --write-ghc-environment-files=always --jobs=2
- cabal v2-build --only-dependencies
script:
- cabal new-build
- cabal new-run semantic:test
- cabal new-run semantic-core:test
- cabal new-run semantic-python:test
- cabal new-run semantic-source:test
- cabal new-run semantic-source:doctest
- cabal v2-build
- cabal v2-run semantic:test
- cabal v2-run semantic-core:test
- cabal v2-run semantic-python:test
- cabal v2-run semantic-source:test
- cabal v2-run semantic-source:doctest
# 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
# branches listed below:

View File

@ -16,6 +16,8 @@ copyright: (c) 2019 GitHub, Inc.
category: Language
extra-source-files: CHANGELOG.md
tested-with: GHC == 8.6.5
library
exposed-modules:
-- other-modules:

View File

@ -16,7 +16,7 @@ build-type: Simple
stability: alpha
extra-source-files: README.md
tested-with: GHC == 8.6.4
tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010

View File

@ -206,8 +206,9 @@ instance Compile Py.ClassDefinition where
pure (typefn $$ Core.string (coerce n) $$ object $$ contents)
body <- compile pybody buildTypeCall next
let assignClass = Name.named' n :<- body
let continuing = fmap (locate it . (assignClass >>>=))
let coreName = Name.named' n
assignClass = coreName :<- (rec coreName body)
continuing = fmap (locate it . (assignClass >>>=))
continuing (local (def n) (cc next))
instance Compile Py.ComparisonOperator
@ -277,7 +278,7 @@ instance Compile Py.FunctionDefinition where
parameters' <- traverse param parameters
body' <- compile body pure next
-- 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
-- with the new name (with 'def'), so that calling contexts know
-- that we have built an exportable definition.

View File

@ -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):
return a

View File

@ -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):
return a

View File

@ -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):
if a: return a

View File

@ -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
y = const(True, True)
z = const(False, False)

View File

@ -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 identity(x):

View File

@ -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):
return x

View File

@ -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():
pass

View File

@ -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():
def identity(self, x):

View File

@ -0,0 +1,2 @@
# CHECK-TREE: { recursive <- rec recursive = \a -> recursive; #record { recursive: recursive }}
def recursive(a): return recursive

View File

@ -16,7 +16,7 @@ build-type: Simple
stability: alpha
extra-source-files: README.md
tested-with: GHC == 8.6.4
tested-with: GHC == 8.6.5
flag release
description: Build with optimizations on (for CI or deployment builds)