Skip to content

Commit

Permalink
Merge pull request #21 from Voiteh/issue/6
Browse files Browse the repository at this point in the history
Fix target constructors finiding, fix tests (#6)
  • Loading branch information
Voiteh authored Jun 23, 2019
2 parents e9dbd0a + 263be21 commit 09e2975
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/herd/depin/api/Target.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ shared abstract class Target extends Injection {


shared FunctionModel<Object>|ValueModel<Object> targetConstructor {
value chain = model.getCallableConstructors(`TargetAnnotation`)
value chain = model.getCallableConstructors<>(`TargetAnnotation`)
.chain(model.getValueConstructors(`TargetAnnotation`));
if (!model.defaultConstructor exists) {
if (chain.empty) {
Expand Down
5 changes: 3 additions & 2 deletions source/herd/depin/engine/DefinitionFactory.ceylon
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import ceylon.language.meta {
type
}
Expand All @@ -19,8 +20,8 @@ shared class DefinitionFactory(Identification.Holder holder) satisfies Definitio
try{
annotations = declaration.annotations<Annotation>()
.select((Annotation element) => holder.types.contains(type(element)));
}catch(Exception x){
//Ceylon BUG!!! We can't identifiy parameter by annotations but for now we can use name of the parameter.
}catch(Throwable x){
//Ceylon BUG (https://github.com/eclipse/ceylon/issues/7448)!!! We can't identifiy parameter by annotations but for now we can use name of the parameter.
//This will be enough for most of cases.
annotations={NamedAnnotation(declaration.name)};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ceylon.test {
test,
ignore
test
}

import herd.depin.engine {
Expand Down Expand Up @@ -41,7 +40,6 @@ shared class ClassInjectionTest() {
shared test void shouldInjectDefaultedParameterClassFunction(){
assert(depin.inject(`DefaultedParameterFunction`).defaultedFunction()==fixture.defaultedParameterFunction.param);
}
ignore("until https://github.com/eclipse/ceylon/issues/7448 fixed")
shared test void shouldInjectTargetedConstructor(){
assert(depin.inject(`TargetWithTwoCallableConstructors`).something==fixture.targetWithTwoCallableConstructors.param.reversed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ shared class TargetWithTwoCallableConstructors {

}

shared target new targetedConstructor(named("Abc") String something){
shared target new targetedConstructor(named("I will be ignored any way! Bug, bug, bug") String something){
this.something=something.reversed;
}

Expand Down

0 comments on commit 09e2975

Please sign in to comment.