Skip to content

Commit

Permalink
Release 0.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanTAllen committed Apr 29, 2017
2 parents 469709c + 8880809 commit e3c67a3
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .travis_script.bash
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ case "${TRAVIS_OS_NAME}:${LLVM_CONFIG}" in

"linux:llvm-config-3.9")
# when FAVORITE_CONFIG stops matching part of this case, move this logic
if [[ "$TRAVIS_BRANCH" == "release" && "$FAVORITE_CONFIG" == "yes" ]]
if [[ "$TRAVIS_BRANCH" == "release" && "$TRAVIS_PULL_REQUEST" == "false" && "$FAVORITE_CONFIG" == "yes" ]]
then
ponyc-build-packages
ponyc-build-docs
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

All notable changes to the Pony compiler and standard library will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a CHANGELOG](http://keepachangelog.com/).

## [unreleased] - unreleased

### Fixed



### Added



### Changed



## [0.13.2] - 2017-04-29

### Fixed

- Don’t consider type arguments inside a constraint as constraints. ([PR #1870](https://github.com/ponylang/ponyc/pull/1870))
- Disable mcx16 on aarch64 ([PR #1856](https://github.com/ponylang/ponyc/pull/1856))
- Fix assert failure on explicit reference to `this` in constructor. (issue #1865) ([PR #1867](https://github.com/ponylang/ponyc/pull/1867))
- Compiler crash when using unconstrained type parameters in an `iftype` condition (issue #1689)

## [0.13.1] - 2017-04-22

### Fixed
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,13 @@ ALL_CXXFLAGS = -std=gnu++11 -fno-rtti

# Determine pointer size in bits.
BITS := $(bits)
UNAME_M := $(shell uname -m)

ifeq ($(BITS),64)
BUILD_FLAGS += -mcx16
LINKER_FLAGS += -mcx16
ifneq ($(UNAME_M),aarch64)
BUILD_FLAGS += -mcx16
LINKER_FLAGS += -mcx16
endif
endif

PONY_BUILD_DIR ?= build/$(config)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.13.1
0.13.2
1 change: 1 addition & 0 deletions release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ git push origin "$version"
# update CHANGELOG for new entries
git checkout master
git merge "release-$version"
changelog-tool unreleased CHANGELOG.md -e

# check if user wants to continue
check_for_commit_and_push
Expand Down
2 changes: 2 additions & 0 deletions src/libponyc/ast/frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ bool frame_push(typecheck_t* t, ast_t* ast)
t->frame->method_type = NULL;
t->frame->ffi_type = NULL;
t->frame->local_type = NULL;
t->frame->constraint = NULL;
t->frame->iftype_constraint = NULL;
break;

case TK_CASE:
Expand Down
2 changes: 1 addition & 1 deletion src/libponyc/expr/reference.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ bool expr_this(pass_opt_t* opt, ast_t* ast)
ast_t* parent = ast_parent(ast);
if((ast_id(parent) == TK_DOT) && (ast_child(parent) == ast))
{
ast_t* def = (ast_t*)ast_data(ast);
ast_t* def = (ast_t*)ast_data(parent);
pony_assert(def != NULL);

switch(ast_id(def))
Expand Down
48 changes: 24 additions & 24 deletions src/libponyc/pass/refer.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,29 @@ static const char* suggest_alt_name(ast_t* ast, const char* name)
return NULL;
}

static bool refer_this(pass_opt_t* opt, ast_t* ast)
{
pony_assert(ast_id(ast) == TK_THIS);

// Can only use a this reference if it hasn't been consumed yet.
sym_status_t status;
ast_get(ast, stringtab("this"), &status);

if(status == SYM_CONSUMED)
{
ast_error(opt->check.errors, ast,
"can't use a consumed 'this' in an expression");
return false;
}
pony_assert(status == SYM_NONE);

// Mark the this reference as incomplete if not all fields are defined yet.
if(is_this_incomplete(opt, ast))
ast_setflag(ast, AST_FLAG_INCOMPLETE);

return true;
}

bool refer_reference(pass_opt_t* opt, ast_t** astp)
{
ast_t* ast = *astp;
Expand Down Expand Up @@ -321,7 +344,7 @@ bool refer_reference(pass_opt_t* opt, ast_t** astp)

ast_replace(astp, dot);
ast = *astp;
return refer_dot(opt, ast);
return refer_this(opt, self) && refer_dot(opt, ast);
}

case TK_PARAM:
Expand Down Expand Up @@ -709,29 +732,6 @@ static bool refer_consume(pass_opt_t* opt, ast_t* ast)
return true;
}

static bool refer_this(pass_opt_t* opt, ast_t* ast)
{
pony_assert(ast_id(ast) == TK_THIS);

// Can only use a this reference if it hasn't been consumed yet.
sym_status_t status;
ast_get(ast, stringtab("this"), &status);

if(status == SYM_CONSUMED)
{
ast_error(opt->check.errors, ast,
"can't use a consumed 'this' in an expression");
return false;
}
pony_assert(status == SYM_NONE);

// Mark the this reference as incomplete if not all fields are defined yet.
if(is_this_incomplete(opt, ast))
ast_setflag(ast, AST_FLAG_INCOMPLETE);

return true;
}

static bool refer_pre_new(pass_opt_t* opt, ast_t* ast)
{
(void)opt;
Expand Down
5 changes: 2 additions & 3 deletions src/libponyc/pass/syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,8 @@ static ast_result_t syntax_arrow(pass_opt_t* opt, ast_t* ast)
pony_assert(ast != NULL);
AST_GET_CHILDREN(ast, left, right);

if(((opt->check.frame->constraint != NULL) ||
(opt->check.frame->iftype_constraint != NULL)) &&
(opt->check.frame->method == NULL))
if((opt->check.frame->constraint != NULL) ||
(opt->check.frame->iftype_constraint != NULL))
{
ast_error(opt->check.errors, ast,
"arrow types can't be used as type constraints");
Expand Down
3 changes: 2 additions & 1 deletion src/libponyc/type/reify.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ static void reify_typeparamref(pass_opt_t* opt, ast_t** astp, ast_t* typeparam,
{
if(ast_name(ref_name) == ast_name(param_name))
{
if(!is_subtype(ref_constraint, param_constraint, NULL, opt))
if((ast_id(param_constraint) != TK_TYPEPARAMREF) &&
!is_subtype(ref_constraint, param_constraint, NULL, opt))
return;
} else {
return;
Expand Down
37 changes: 34 additions & 3 deletions test/libponyc/badpony.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ TEST_F(BadPonyTest, ClassInOtherClassProvidesList)
TEST_ERRORS_1(src, "can only provide traits and interfaces");
}


TEST_F(BadPonyTest, TypeParamMissingForTypeInProvidesList)
{
// From issue #219
Expand Down Expand Up @@ -402,7 +401,7 @@ TEST_F(BadPonyTest, TypeParamArrowClass)
TEST_COMPILE(src);
}

TEST_F(BadPonyTest, ArrowTypeParamInConstraint)
TEST_F(BadPonyTest, ArrowTypeParamInTypeConstraint)
{
// From issue #1694
const char* src =
Expand All @@ -414,6 +413,17 @@ TEST_F(BadPonyTest, ArrowTypeParamInConstraint)
"arrow types can't be used as type constraints");
}

TEST_F(BadPonyTest, ArrowTypeParamInMethodConstraint)
{
// From issue #1809
const char* src =
"class Foo\n"
" fun foo[X: box->Y, Y](x: X) => None";

TEST_ERRORS_1(src,
"arrow types can't be used as type constraints");
}

TEST_F(BadPonyTest, AnnotatedIfClause)
{
// From issue #1751
Expand Down Expand Up @@ -455,7 +465,6 @@ TEST_F(BadPonyTest, ObjectInheritsLaterTraitMethodWithParameter)
TEST_COMPILE(src);
}


TEST_F(BadPonyTest, AddressofMissingTypearg)
{
const char* src =
Expand All @@ -468,3 +477,25 @@ TEST_F(BadPonyTest, AddressofMissingTypearg)
TEST_ERRORS_1(src,
"not enough type arguments");
}

TEST_F(BadPonyTest, ThisDotFieldRef)
{
// From issue #1865
const char* src =
"actor Main\n"
" let f: U8\n"
" new create(env: Env) =>\n"
" this.f = 1\n";

TEST_COMPILE(src);
}

TEST_F(BadPonyTest, CapSetInConstraintTypeParam)
{
const char* src =
"class A[X]\n"
"class B[X: A[Any #read]]\n";

TEST_ERRORS_1(src,
"a capability set can only appear in a type constraint");
}
19 changes: 19 additions & 0 deletions test/libponyc/iftype.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,22 @@ TEST_F(IftypeTest, Codegen_False)
ASSERT_TRUE(run_program(&exit_code));
ASSERT_EQ(exit_code, 1);
}


TEST_F(IftypeTest, UnconstrainedTypeparam)
{
const char* src =
"class C\n"
" fun tag c() => None\n"

"actor Main\n"
" new create(env: Env) =>\n"
" foo[C](C)\n"

" fun foo[A](x: A) =>\n"
" iftype A <: C then\n"
" x.c()\n"
" end";

TEST_COMPILE(src);
}

0 comments on commit e3c67a3

Please sign in to comment.