Changes in / [fbe3f03:60c5b6d]
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Type.hpp
rfbe3f03 r60c5b6d 430 430 TypeInstType( const TypeInstType & o ) = default; 431 431 432 TypeInstType( const TypeEnvKey & key );432 explicit TypeInstType( const TypeEnvKey & key ); 433 433 434 434 /// sets `base`, updating `kind` correctly -
src/ResolvExpr/CandidateFinder.cpp
rfbe3f03 r60c5b6d 1400 1400 } 1401 1401 } 1402 1402 1403 1403 CandidateRef newCand = std::make_shared<Candidate>( 1404 1404 newExpr, copy( tenv ), ast::OpenVarSet{}, ast::AssertionSet{}, bentConversion? Cost::safe: Cost::zero, … … 1794 1794 auto commonAsEnumAttr = common.as<ast::EnumAttrType>(); 1795 1795 if ( commonAsEnumAttr && commonAsEnumAttr->attr == ast::EnumAttribute::Value ) { 1796 1797 1796 auto callExpr = new ast::UntypedExpr( 1798 1797 cand->expr->location, new ast::NameExpr( cand->expr->location, "valueE"), {cand->expr} ); … … 1823 1822 // if this somehow changes in the future (e.g. delayed by indeterminate return type) 1824 1823 // we may need to revisit the logic. 1825 inferParameters( newCand, matches ); 1824 inferParameters( newCand, matches ); 1826 1825 } 1827 } 1828 } 1826 } 1827 } 1829 1828 } 1830 1829 } … … 2151 2150 } 2152 2151 2153 // get the valueE(...) ApplicationExpr that returns the enum value 2154 const ast::Expr * getValueEnumCall( 2155 const ast::Expr * expr, 2156 const ResolvExpr::ResolveContext & context, const ast::TypeEnvironment & env ) { 2157 auto callExpr = new ast::UntypedExpr( 2158 expr->location, new ast::NameExpr( expr->location, "valueE"), {expr} ); 2159 CandidateFinder finder( context, env ); 2160 finder.find( callExpr ); 2161 CandidateList winners = findMinCost( finder.candidates ); 2162 if (winners.size() != 1) { 2163 SemanticError( callExpr, "Ambiguous expression in valueE" ); 2164 } 2165 CandidateRef & choice = winners.front(); 2166 return choice->expr; 2152 const ast::Expr * getValueEnumCall( const ast::Expr * expr, 2153 const ResolveContext & context, const ast::TypeEnvironment & env ) { 2154 auto callExpr = new ast::UntypedExpr( 2155 expr->location, new ast::NameExpr( expr->location, "valueE"), {expr} ); 2156 CandidateFinder finder( context, env ); 2157 finder.find( callExpr ); 2158 CandidateList winners = findMinCost( finder.candidates ); 2159 if (winners.size() != 1) { 2160 SemanticError( callExpr, "Ambiguous expression in valueE" ); 2161 } 2162 CandidateRef & choice = winners.front(); 2163 return choice->expr; 2167 2164 } 2168 2165 -
src/ResolvExpr/CandidateFinder.hpp
rfbe3f03 r60c5b6d 30 30 struct CandidateFinder { 31 31 CandidateList candidates; ///< List of candidate resolutions 32 const ResolveContext & context; ///< Information about where the canditates are being found.32 const ResolveContext & context; ///< Information about where the canditates are being found. 33 33 const ast::TypeEnvironment & env; ///< Substitutions performed in this resolution 34 34 ast::ptr< ast::Type > targetType; ///< Target type for resolution 35 35 bool strictMode = false; ///< If set to true, requires targetType to be exact match (inside return cast) 36 36 bool allowVoid = false; ///< If set to true, allow void-returning function calls (only top level, cast to void and first in comma) 37 std::set< std::string > otypeKeys; ///different type may map to same key37 std::set< std::string > otypeKeys; ///< different type may map to same key 38 38 39 39 CandidateFinder( … … 70 70 const ast::Expr * expr, Cost & cost ); 71 71 72 const ast::Expr * getValueEnumCall(const ast::Expr * expr, 73 const ResolvExpr::ResolveContext & context, const ast::TypeEnvironment & env ); 72 /// Get the valueE application that returns the enum's value. 73 const ast::Expr * getValueEnumCall( const ast::Expr * expr, 74 const ResolveContext & context, const ast::TypeEnvironment & env ); 75 74 76 /// Wrap an expression to convert the result to a conditional result. 75 77 const ast::Expr * createCondExpr( const ast::Expr * expr ); -
src/Tuples/TupleAssignment.cc
rfbe3f03 r60c5b6d 35 35 #include "InitTweak/GenInit.h" // for genCtorInit 36 36 #include "InitTweak/InitTweak.h" // for getPointerBase, isAssignment 37 #include "ResolvExpr/CandidateFinder.hpp" // for CandidateFinder 37 38 #include "ResolvExpr/Cost.h" // for Cost 38 39 #include "ResolvExpr/Resolver.h" // for resolveCtorInit -
src/Tuples/Tuples.h
rfbe3f03 r60c5b6d 21 21 #include "AST/Fwd.hpp" 22 22 #include "AST/Node.hpp" 23 #include "ResolvExpr/CandidateFinder.hpp" 23 namespace ResolvExpr { 24 class CandidateFinder; 25 } 24 26 25 27 namespace Tuples {
Note: See TracChangeset
for help on using the changeset viewer.