Skip to content

Instantly share code, notes, and snippets.

View lucaswerkmeister's full-sized avatar

Lucas Werkmeister lucaswerkmeister

View GitHub Profile
@lucaswerkmeister
lucaswerkmeister / update-all.sh
Last active August 29, 2015 14:00
Script to update an existing Ceylon distribution (including the SDK and IDE)
#!/bin/bash
cd "$(dirname "$0")"
# ceylon-dist, including ceylon-common, ceylon-compiler, ceylon-js, ceylon-module-resolver, ceylon-runtime, ceylon-spec and ceylon.language
cd ceylon-dist
echo "$0: Updating ceylon-dist"
printf "%$(tput cols)s\n" | tr ' ' '='
ant clean-all update-all publish-all ide
echo $'\nDone.\n'
cd ..
# ceylon-sdk
@noanno class C() {
@noanno void f() {
@noanno void x() {
@noanno g(this);
}
}
@noanno void g(@noanno C c) {
}
}
@lucaswerkmeister
lucaswerkmeister / linkStacktrace.md
Created May 1, 2014 12:51
Linked stacktrace for ceylon/ceylon-language#441

Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) Caused by: ceylon.language.AssertionError "Class has more than one overloaded constructor" at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClass.init(FreeClass.java:57) at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.checkInit(FreeClassOrInterface.java:148) at com.redhat.ceylon.compiler.java.runtime.metamodel.FreeClassOrInterface.getTypeParameterDeclarations([FreeClassOrInterface.java:328](https://gith

@noanno class C() {
@noanno assert (exists @noanno c = "a".first);
@noanno shared Character b => c;
}
Visit was called 168 times, 126 times with a non-null argument, but with only 11 distinct arguments.
This took 1201ms.
@lucaswerkmeister
lucaswerkmeister / pre-push
Last active August 29, 2015 14:01
A Git pre-push hook to check that all Ceylon files are formatted in the latest tree
#!/bin/bash
# A git hook to check that committed Ceylon source code is formatted before it
# is pushed. "Ceylon source code" means all files whose name matches the find
# pattern from `git config hooks.ceyloncodePattern` (defaulting to '*.ceylon'
# if that is unset) and the find regex from `git config hooks.ceyloncodeRegex`
# (defaulting to '.*' if that is unset).
# Adapted from the pre-push.sample file shipped with git.
quit() {
@noanno void run() {
@noanno printStackTrace(@noanno Exception(), (String s) => 1);
}
@lucaswerkmeister
lucaswerkmeister / trackingIssue.sh
Last active August 29, 2015 14:01
Script used to generate ceylon/ceylon.ast#9
#!/bin/bash
echo 'I want to make sure that I don’t forget to implement any AST nodes,' \
'so here’s a giant task list with all of them:';
grep '^\^' ../ceylon-spec/Ceylon.nodes `# node definition lines` |
sed \
-e 's|^\^(\(abstract \)\?\([A-Z_]*\).*|\2|' `# NODE_NAME` \
-e 's \(.*\) \L\1 ' `# node_name` \
-e 's _\(.\) \U\1 g' `# nodeName` \
@lucaswerkmeister
lucaswerkmeister / algo.md
Created May 26, 2014 16:58
Algorithm to determine validity of inherited optional annotations for ceylon/ceylon-spec#914

Algorithm to determine validity of inherited optional annotations for ceylon/ceylon-spec#914

Input

  • A tree of all supertypes of a type which define or refine some attribute / method / the type itself, represented in a form that lets us start at the type itself and for each type enumerate all supertypes in the tree.
  • On each type, a “self annotation” field shall be set to the annotation instance that was defined on this type, or null if it wasn’t defined on this type.

The identity of a specific annotation instance shall include the type on which it was defined.

Data attached to each node

@lucaswerkmeister
lucaswerkmeister / bug.ceylon
Created May 27, 2014 20:46
Additional info for a Ceylon bug
@noanno abstract class Foo() {
@noanno shared formal class Bar() {
@noanno shared formal String baz;
}
@noanno shared String brokenHello = Bar().baz;
@noanno shared String hello = "Hello World";
}
@noanno class Foo2() extends Foo(){
@noanno shared actual class Bar()