<commit_before>package com.redhat.ceylon.compiler.typechecker.util;

import com.redhat.ceylon.compiler.typechecker.analyzer.Warning;
import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.compiler.typechecker.tree.Visitor;
import com.redhat.ceylon.model.typechecker.model.Declaration;
import com.redhat.ceylon.model.typechecker.model.TypeDeclaration;

public class DeprecationVisitor extends Visitor {
    
    @Override
    public void visit(Tree.MemberOrTypeExpression that) {
        super.visit(that);
        Declaration d = that.getDeclaration();
		if (d!=null && d.isDeprecated()) {
		    that.addUsageWarning(Warning.deprecation,
                    "declaration is deprecated: '" + 
                        d.getName() + "'");
        }
    }
    @Override
    public void visit(Tree.SimpleType that) {
    	super.visit(that);<commit_msg>fix #1437 deprecated default constructors<commit_after>package com.redhat.ceylon.compiler.typechecker.util;

import com.redhat.ceylon.compiler.typechecker.analyzer.Warning;
import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.compiler.typechecker.tree.Visitor;
import com.redhat.ceylon.model.typechecker.model.Class;
import com.redhat.ceylon.model.typechecker.model.Constructor;
import com.redhat.ceylon.model.typechecker.model.Declaration;
import com.redhat.ceylon.model.typechecker.model.TypeDeclaration;

public class DeprecationVisitor extends Visitor {
    
    @Override
    public void visit(Tree.MemberOrTypeExpression that) {
        super.visit(that);
        Declaration d = that.getDeclaration();
		if (d!=null && d.isDeprecated()) {
		    that.addUsageWarning(Warning.deprecation,
                    "declaration is deprecated: '" + 
                        d.getName() + "'");
        }
		if (d instanceof Class && 
		        that.getDirectlyInvoked()) {
		    Class c = (Class) d;
            Constructor dc = c.getDefaultConstructor();
            if (dc!=null && dc.isDeprecated()) {
                that.addUsageWarning(Warning.deprecation,
                        "declaration is deprecated: default constructor of '" + 
                            d.getName() + "'");
            }
		}
    }
    @Override
    public void visit(Tree.SimpleType that) {
    	super.visit(that);
{'fraction_non_alphanumeric': 0.11222270552414093, 'fraction_numerical': 0.0017398869073510222, 'mean_word_length': 2.859060402684564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '376984', 'n_tokens_mistral': 694, 'n_tokens_neox': 661, 'n_words': 110}