Skip to content

Commit

Permalink
Merge #549
Browse files Browse the repository at this point in the history
549: Release cleanup r=Marwes a=Marwes



Co-authored-by: Markus Westerlind <marwes91@gmail.com>
  • Loading branch information
bors[bot] and Marwes committed Jun 24, 2018
2 parents eff8bc2 + bb4d05d commit b7c88ed
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 39 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ features = ["docs_rs"]

[profile.bench]
debug = true

2 changes: 1 addition & 1 deletion base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ documentation = "https://docs.rs/gluon"
log = "0.4"
quick-error = "1.0.0"
fnv = "1.0.3"
pretty = "0.3"
pretty = "0.5"
smallvec = "0.6"
collect-mac = "0.1.0"
anymap = "0.12.0"
Expand Down
4 changes: 2 additions & 2 deletions check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ collect-mac = "0.1.0"
log = "0.4"
itertools = "0.7"
union-find = "0.3.1"
pretty = "0.3"
pretty = "0.5"
smallvec = "0.6"
rpds = "0.5"

Expand All @@ -30,7 +30,7 @@ gluon_parser = { path = "../parser", version = "0.8.0", optional = true } # GLUO
[dev-dependencies]
env_logger = "0.5"

gluon_format = { path = "../format", version = "0.8.0" } # GLUON
gluon_format = { path = "../format", version = "<0.9.0, >=0.7.0" }

collect-mac = "0.1.0"
pretty_assertions = "0.5"
Expand Down
4 changes: 2 additions & 2 deletions codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ proc-macro2 = "0.4"
[dev-dependencies]
serde = "1.0.0"
serde_derive = "1.0.0"
gluon = { version = "0.8.0", path = "..", features = ["serialization"] } # GLUON
gluon_vm = { version = "0.8.0", path = "../vm" } # GLUON
gluon = { version = ">=0.7.0", path = "..", features = ["serialization"] } # GLUON
gluon_vm = { version = ">=0.7.0", path = "../vm" } # GLUON
51 changes: 33 additions & 18 deletions completion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ impl<E: TypeEnv> OnFound for Suggest<E> {
fn on_pattern(&mut self, pattern: &SpannedPattern<Symbol>) {
match pattern.value {
Pattern::As(ref id, ref pat) => {
self.stack.insert(id.clone(), pat.env_type_of(&self.env));
self.stack.insert(
id.clone(),
pat.try_type_of(&self.env).unwrap_or_else(|_| Type::hole()),
);
self.on_pattern(pat);
}
Pattern::Ident(ref id) => {
Expand Down Expand Up @@ -795,10 +798,16 @@ impl<'a> Extract for TypeAt<'a> {

fn match_extract(self, found: &Match) -> Result<Self::Output, ()> {
Ok(match *found {
Match::Expr(expr) => Either::Right(expr.env_type_of(self.env)),
Match::Expr(expr) => expr
.try_type_of(self.env)
.map(Either::Right)
.map_err(|_| ())?,
Match::Ident(_, _, ref typ) => Either::Right(typ.clone()),
Match::Type(_, _, ref kind) => Either::Left(kind.clone()),
Match::Pattern(pattern) => Either::Right(pattern.env_type_of(self.env)),
Match::Pattern(pattern) => pattern
.try_type_of(self.env)
.map(Either::Right)
.map_err(|_| ())?,
})
}
}
Expand Down Expand Up @@ -1153,8 +1162,10 @@ impl SuggestionQuery {
ref fields,
..
} => {
let typ = resolve::remove_aliases(env, pattern.env_type_of(env));
self.suggest_fields_of_type(&mut result, types, fields, "", &typ);
if let Ok(typ) = expr.try_type_of(&env) {
let typ = resolve::remove_aliases(env, typ);
self.suggest_fields_of_type(&mut result, types, fields, "", &typ);
}
""
}
_ => "",
Expand All @@ -1173,17 +1184,19 @@ impl SuggestionQuery {
Match::Ident(_, ident, _) => match *enclosing_match {
Match::Expr(context) => match context.value {
Expr::Projection(ref expr, _, _) => {
let typ = resolve::remove_aliases(&env, expr.env_type_of(&env));
let id = ident.as_ref();

let iter = typ
.row_iter()
.filter(move |field| self.filter(field.name.as_ref(), id))
.map(|field| (field.name.clone(), field.typ.clone()));
result.extend(iter.map(|(name, typ)| Suggestion {
name: name.declared_name().into(),
typ: Either::Right(typ),
}));
if let Ok(typ) = expr.try_type_of(&env) {
let typ = resolve::remove_aliases(&env, typ);
let id = ident.as_ref();

let iter = typ
.row_iter()
.filter(move |field| self.filter(field.name.as_ref(), id))
.map(|field| (field.name.clone(), field.typ.clone()));
result.extend(iter.map(|(name, typ)| Suggestion {
name: name.declared_name().into(),
typ: Either::Right(typ),
}));
}
}
Expr::Ident(ref id) if id.name.is_global() => {
self.suggest_module_import(env, &id.name.as_ref()[1..], &mut result);
Expand Down Expand Up @@ -1261,8 +1274,10 @@ impl SuggestionQuery {
ref fields,
..
} => {
let typ = resolve::remove_aliases(env, pattern.env_type_of(env));
self.suggest_fields_of_type(&mut result, types, fields, "", &typ);
if let Ok(typ) = pattern.try_type_of(env) {
let typ = resolve::remove_aliases(env, typ);
self.suggest_fields_of_type(&mut result, types, fields, "", &typ);
}
}
_ => result.extend(suggest.patterns.iter().map(|(name, typ)| Suggestion {
name: name.declared_name().into(),
Expand Down
9 changes: 8 additions & 1 deletion doc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ name = "gluon_doc"
version = "0.8.0" # GLUON
authors = ["Markus Westerlind <marwes91@gmail.com>"]

license = "MIT"

description = "The documentation generator for the gluon programming language"

repository = "https://github.com/gluon-lang/gluon"
documentation = "https://docs.rs/gluon"

[dependencies]
log = "0.4"
env_logger = "0.5"
Expand All @@ -12,7 +19,7 @@ handlebars = "=1.0.0-beta.1"
clap = "2.22.0"
itertools = "0.7"
structopt = "0.2"
pretty = "0.3"
pretty = "0.5"
pulldown-cmark = "0.1"
regex = "1"
lazy_static = "1"
Expand Down
2 changes: 1 addition & 1 deletion format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentation = "https://docs.rs/gluon"

[dependencies]
log = "0.4"
pretty = "0.3"
pretty = "0.5"
itertools = "0.7"
codespan = "0.1.1"

Expand Down
14 changes: 14 additions & 0 deletions format/src/pretty_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ where
.append(arena.concat(arg_iter).nest(INDENT))
.group()
}

Expr::Array(ref array) => arena
.text("[")
.append(
Expand All @@ -135,6 +136,7 @@ where
)
.append("]")
.group(),

Expr::Block(ref elems) => if elems.len() == 1 {
chain![arena;
"(",
Expand All @@ -152,7 +154,9 @@ where
}
}))
},

Expr::Ident(ref id) => pretty_types::ident(arena, id.name.as_ref()),

Expr::IfElse(ref body, ref if_true, ref if_false) => {
let space = newline(arena, expr);
chain![arena;
Expand All @@ -165,6 +169,7 @@ where
self.pretty_else_expr(space, if_false)
]
}

Expr::Infix {
ref lhs,
ref op,
Expand All @@ -179,10 +184,12 @@ where
pretty(rhs).group()
].nest(INDENT)
],

Expr::Lambda(_) => {
let (arguments, body) = self.pretty_lambda(previous_end, expr);
arguments.group().append(body)
}

Expr::LetBindings(ref binds, ref body) => {
let binding = |prefix: &'a str, bind: &'a ValueBinding<I>| {
let decl = chain![arena;
Expand Down Expand Up @@ -225,7 +232,9 @@ where
self.pretty_expr_(binds.last().unwrap().span().end(), body).group()
]
}

Expr::Literal(_) => arena.text(self.source.src_slice(expr.span)),

Expr::Match(ref expr, ref alts) => chain![arena;
chain![arena;
"match ",
Expand All @@ -242,15 +251,18 @@ where
]
}).intersperse(arena.newline()))
],

Expr::Projection(ref expr, ref field, _) => chain![arena;
pretty(expr),
".",
pretty_types::ident(arena, field.as_ref())
],

Expr::Record { .. } => {
let (x, y) = self.pretty_lambda(previous_end, expr);
x.append(y).group()
}

Expr::Tuple { ref elems, .. } => chain![arena;
"(",
arena.concat(
Expand All @@ -263,6 +275,7 @@ where
),
")"
].group(),

Expr::TypeBindings(ref binds, ref body) => {
let prefixes = iter::once("type").chain(iter::repeat("and"));
chain![arena;
Expand Down Expand Up @@ -322,6 +335,7 @@ where
self.pretty_expr_(binds.last().unwrap().alias.span.end(), body)
].group()
}

Expr::Do(Do {
ref id,
ref bound,
Expand Down
11 changes: 11 additions & 0 deletions format/tests/pretty_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,3 +405,14 @@ type TestCase a =
0
);
}

#[test]
fn multiline_string() {
let expr = r#"
let x = "abc
123
"
x
"#;
assert_diff!(&format_expr(expr).unwrap(), expr, " ", 0);
}
2 changes: 1 addition & 1 deletion parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ itertools = "0.7"
quick-error = "1.0.0"
lalrpop-util = "0.15.1"
log = "0.4"
pretty = "0.3"
pretty = "0.5"
gluon_base = { path = "../base", version = "0.8.0" } # GLUON
ordered-float = "0.5.0" # gluon_base
codespan = "0.1.1"
Expand Down
1 change: 1 addition & 0 deletions repl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ rexpect = "0.3.0"

[features]
default = ["env_logger"]

7 changes: 4 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/bin/sh
set -ex

PROJECTS=(
declare -a PROJECTS=(
base
parser
check
completion
vm
format
codegen
.
format
c-api
doc
repl
)

for PROJECT in "$PROJECTS"
for PROJECT in "${PROJECTS[@]}"
do
(cd $PROJECT && cargo publish $@)
done
4 changes: 2 additions & 2 deletions vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ log = "0.4"
quick-error = "1.1.0"
mopa = "0.2.2"
collect-mac = "0.1.0"
pretty = "0.3"
pretty = "0.5"
bitflags = "1.0.0"
itertools = "0.7"
futures = "0.1.0"
Expand All @@ -44,7 +44,7 @@ lalrpop = { version = "0.15.1", optional = true }
env_logger = "0.5"
# HACK Trick crates.io into letting letting this be published with a dependency on gluon
# (which requires gluon_vm to be published)
gluon = { path = "..", version = "<0.9.0, >=0.8.0" }
gluon = { path = "..", version = "<0.9.0, >=0.7.0" }

lalrpop-util = "0.15.1"
regex = "0.2.0"
Expand Down

0 comments on commit b7c88ed

Please sign in to comment.