~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to src/gf.c

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-02-06 17:54:29 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20130206175429-13br5kqpkfjqdmre
Tags: 0.0.0+20130206.git32ff5759-1
* New upstream snapshot.
* debian/copyright: reflect upstream changes
* debian/rules: update get-orig-source to reflect upstream changes
   + Don't ship nginx
   + Adapt for new configure-random target in deps/Makefile
* Enable build of Tk wrapper.
   + debian/control: add build dependency on tk-dev
   + debian/rules: add tk rule to build-arch
* debian/julia.install: install VERSION and COMMIT files
* no-webrepl.patch: new patch
* Refresh other patches
* Add source override for config.status file under deps/random/

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
        return NULL;
456
456
    if (i < len-1)
457
457
        return jl_tupleref(sig, i);
458
 
    if (jl_is_seq_type(jl_tupleref(sig,len-1))) {
 
458
    if (jl_is_vararg_type(jl_tupleref(sig,len-1))) {
459
459
        return jl_tparam0(jl_tupleref(sig,len-1));
460
460
    }
461
461
    if (i == len-1)
542
542
            if (i < jl_tuple_len(decl)) {
543
543
                jl_value_t *declt = jl_tupleref(decl,i);
544
544
                // for T..., intersect with T
545
 
                if (jl_is_seq_type(declt))
 
545
                if (jl_is_vararg_type(declt))
546
546
                    declt = jl_tparam0(declt);
547
547
                if (declt == (jl_value_t*)jl_tuple_type ||
548
548
                    jl_subtype((jl_value_t*)jl_tuple_type, declt, 0)) {
609
609
            if (i < jl_tuple_len(decl)) {
610
610
                jl_value_t *declt = jl_tupleref(decl,i);
611
611
                // for T..., intersect with T
612
 
                if (jl_is_seq_type(declt))
 
612
                if (jl_is_vararg_type(declt))
613
613
                    declt = jl_tparam0(declt);
614
614
                jl_tupleset(type, i,
615
615
                            jl_type_intersection(declt, (jl_value_t*)jl_typetype_type));
709
709
    // supertype of any other method signatures. so far we are conservative
710
710
    // and the types we find should be bigger.
711
711
    if (jl_tuple_len(type) > mt->max_args &&
712
 
        jl_is_seq_type(jl_tupleref(decl,jl_tuple_len(decl)-1))) {
 
712
        jl_is_vararg_type(jl_tupleref(decl,jl_tuple_len(decl)-1))) {
713
713
        size_t nspec = mt->max_args + 2;
714
714
        jl_tuple_t *limited = jl_alloc_tuple(nspec);
715
715
        for(i=0; i < nspec-1; i++) {
738
738
            if (jl_is_type_type(lasttype) && jl_is_type_type(jl_tparam0(lasttype)))
739
739
                lasttype = (jl_value_t*)jl_type_type;
740
740
            temp = (jl_value_t*)jl_tuple1(lasttype);
741
 
            jl_tupleset(type, i, jl_apply_type((jl_value_t*)jl_seq_type,
 
741
            jl_tupleset(type, i, jl_apply_type((jl_value_t*)jl_vararg_type,
742
742
                                               (jl_tuple_t*)temp));
743
743
        }
744
744
        else {
994
994
 
995
995
static int is_va_tuple(jl_tuple_t *t)
996
996
{
997
 
    return (jl_tuple_len(t)>0 && jl_is_seq_type(jl_tupleref(t,jl_tuple_len(t)-1)));
 
997
    return (jl_tuple_len(t)>0 && jl_is_vararg_type(jl_tupleref(t,jl_tuple_len(t)-1)));
998
998
}
999
999
 
1000
 
static void print_func_loc(ios_t *s, jl_lambda_info_t *li);
 
1000
static void print_func_loc(JL_STREAM *s, jl_lambda_info_t *li);
1001
1001
 
1002
1002
/*
1003
1003
  warn about ambiguous method priorities
1042
1042
        }
1043
1043
        char *n = fname->name;
1044
1044
        jl_value_t *errstream = jl_stderr_obj();
1045
 
        ios_t *s = JL_STDERR;
1046
 
        ios_printf(s, "Warning: New definition %s", n);
 
1045
        JL_STREAM *s = JL_STDERR;
 
1046
        JL_PRINTF(s, "Warning: New definition %s", n);
1047
1047
        jl_show(errstream, (jl_value_t*)type);
1048
 
        print_func_loc(s, linfo);
1049
 
        ios_printf(s, " is ambiguous with %s", n);
 
1048
        JL_PRINTF(s, " is ambiguous with %s", n);
1050
1049
        jl_show(errstream, (jl_value_t*)sig);
1051
1050
        print_func_loc(s, oldmeth->func->linfo);
1052
 
        ios_printf(s, ".\n         Make sure %s", n);
 
1051
        JL_PRINTF(s, ".\n         Make sure %s", n);
1053
1052
        jl_show(errstream, isect);
1054
 
        ios_printf(s, " is defined first.\n");
 
1053
        JL_PRINTF(s, " is defined first.\n");
1055
1054
    done_chk_amb:
1056
1055
        JL_GC_POP();
1057
1056
    }
1063
1062
    for(i=0; i < jl_tuple_len(type); i++) {
1064
1063
        jl_value_t *t = jl_tupleref(type,i);
1065
1064
        if (jl_is_union_type(t) ||
1066
 
            (jl_is_seq_type(t) && jl_is_union_type(jl_tparam0(t))))
 
1065
            (jl_is_vararg_type(t) && jl_is_union_type(jl_tparam0(t))))
1067
1066
            return 1;
1068
1067
    }
1069
1068
    return 0;
1089
1088
                 method->linfo->module != jl_base_module)) {
1090
1089
                jl_module_t *newmod = method->linfo->module;
1091
1090
                jl_value_t *errstream = jl_stderr_obj();
1092
 
                ios_t *s = JL_STDERR;
1093
 
                ios_printf(s, "Warning: Method definition %s", method->linfo->name->name);
 
1091
                JL_STREAM *s = JL_STDERR;
 
1092
                JL_PRINTF(s, "Warning: Method definition %s", method->linfo->name->name);
1094
1093
                jl_show(errstream, (jl_value_t*)type);
1095
 
                ios_printf(s, " in module %s", l->func->linfo->module->name->name);
 
1094
                JL_PRINTF(s, " in module %s", l->func->linfo->module->name->name);
1096
1095
                print_func_loc(s, l->func->linfo);
1097
 
                ios_printf(s, " overwritten in module %s", newmod->name->name);
 
1096
                JL_PRINTF(s, " overwritten in module %s", newmod->name->name);
1098
1097
                print_func_loc(s, method->linfo);
1099
 
                ios_printf(s, ".\n");
 
1098
                JL_PRINTF(s, ".\n");
1100
1099
            }
1101
1100
            JL_SIGATOMIC_BEGIN();
1102
1101
            l->sig = type;
1103
1102
            l->tvars = tvars;
1104
1103
            l->va = (jl_tuple_len(type) > 0 &&
1105
 
                     jl_is_seq_type(jl_tupleref(type,jl_tuple_len(type)-1))) ?
 
1104
                     jl_is_vararg_type(jl_tupleref(type,jl_tuple_len(type)-1))) ?
1106
1105
                1 : 0;
1107
1106
            l->invokes = JL_NULL;
1108
1107
            l->func = method;
1129
1128
    newrec->sig = type;
1130
1129
    newrec->tvars = tvars;
1131
1130
    newrec->va = (jl_tuple_len(type) > 0 &&
1132
 
                  jl_is_seq_type(jl_tupleref(type,jl_tuple_len(type)-1))) ?
 
1131
                  jl_is_vararg_type(jl_tupleref(type,jl_tuple_len(type)-1))) ?
1133
1132
        1 : 0;
1134
1133
    newrec->func = method;
1135
1134
    newrec->invokes = JL_NULL;
1438
1437
        newsig = (jl_tuple_t*)m->sig;
1439
1438
 
1440
1439
        if (env != (jl_value_t*)jl_false) {
1441
 
            tpenv = (jl_tuple_t*)env;
 
1440
            jl_value_t *ti =
 
1441
                lookup_match((jl_value_t*)tt, (jl_value_t*)m->sig, &tpenv, m->tvars);
 
1442
            assert(ti != (jl_value_t*)jl_bottom_type);
 
1443
            (void)ti;
1442
1444
            // don't bother computing this if no arguments are tuples
1443
1445
            for(i=0; i < jl_tuple_len(tt); i++) {
1444
1446
                if (jl_is_tuple(jl_tupleref(tt,i)))
1458
1460
    return jl_apply(mfunc, args, nargs);
1459
1461
}
1460
1462
 
1461
 
static void print_func_loc(ios_t *s, jl_lambda_info_t *li)
 
1463
static void print_func_loc(JL_STREAM *s, jl_lambda_info_t *li)
1462
1464
{
1463
1465
    long lno = li->line;
1464
1466
    if (lno > 0) {
1469
1471
 
1470
1472
static void print_methlist(jl_value_t *outstr, char *name, jl_methlist_t *ml)
1471
1473
{
1472
 
    ios_t *s = (ios_t*)jl_iostr_data(outstr);
 
1474
    JL_STREAM *s = (JL_STREAM*)jl_iostr_data(outstr);
1473
1475
    while (ml != JL_NULL) {
1474
1476
        JL_PRINTF(s, "%s", name);
1475
1477
        if (ml->tvars != jl_null) {